2018-12-15 06:36:18 +11:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'rails_helper'
|
|
|
|
|
2024-09-04 15:12:25 +10:00
|
|
|
RSpec.describe Admin::DashboardController do
|
2021-05-06 22:22:54 +10:00
|
|
|
render_views
|
|
|
|
|
2018-12-15 06:36:18 +11:00
|
|
|
describe 'GET #index' do
|
2024-08-28 00:59:56 +10:00
|
|
|
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Owner')) }
|
|
|
|
|
2021-05-06 22:22:54 +10:00
|
|
|
before do
|
2024-08-28 00:59:56 +10:00
|
|
|
stub_system_checks
|
|
|
|
Fabricate :software_update
|
|
|
|
sign_in(user)
|
2021-05-06 22:22:54 +10:00
|
|
|
end
|
|
|
|
|
2024-08-28 00:59:56 +10:00
|
|
|
it 'returns http success and body with system check messages' do
|
2018-12-15 06:36:18 +11:00
|
|
|
get :index
|
|
|
|
|
2024-08-28 00:59:56 +10: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-15 06:36:18 +11:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|