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