2018-12-14 19:36:18 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'rails_helper'
|
|
|
|
|
2024-09-04 06:12:25 +01:00
|
|
|
RSpec.describe Admin::DashboardController do
|
2021-05-06 13:22:54 +01:00
|
|
|
render_views
|
|
|
|
|
2018-12-14 19:36:18 +00:00
|
|
|
describe 'GET #index' do
|
2024-08-27 15:59:56 +01:00
|
|
|
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Owner')) }
|
|
|
|
|
2021-05-06 13:22:54 +01:00
|
|
|
before do
|
2024-08-27 15:59:56 +01:00
|
|
|
stub_system_checks
|
|
|
|
Fabricate :software_update
|
|
|
|
sign_in(user)
|
2021-05-06 13:22:54 +01:00
|
|
|
end
|
|
|
|
|
2024-08-27 15:59:56 +01:00
|
|
|
it 'returns http success and body with system check messages' do
|
2018-12-14 19:36:18 +00:00
|
|
|
get :index
|
|
|
|
|
2024-08-27 15:59:56 +01:00
|
|
|
expect(response)
|
|
|
|
.to have_http_status(200)
|
|
|
|
.and have_attributes(
|
|
|
|
body: include(I18n.t('admin.system_checks.software_version_patch_check.message_html'))
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def stub_system_checks
|
|
|
|
stub_const 'Admin::SystemCheck::ACTIVE_CHECKS', [
|
|
|
|
Admin::SystemCheck::SoftwareVersionCheck,
|
|
|
|
]
|
2018-12-14 19:36:18 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|