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