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