mirror of https://github.com/Siphonay/mastodon
Add checks about response body content to admin/dash spec (#30716)
This commit is contained in:
parent
c73868cd78
commit
3959f36d19
|
@ -6,19 +6,30 @@ describe Admin::DashboardController do
|
||||||
render_views
|
render_views
|
||||||
|
|
||||||
describe 'GET #index' do
|
describe 'GET #index' do
|
||||||
|
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Owner')) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
allow(Admin::SystemCheck).to receive(:perform).and_return([
|
stub_system_checks
|
||||||
Admin::SystemCheck::Message.new(:database_schema_check),
|
Fabricate :software_update
|
||||||
Admin::SystemCheck::Message.new(:rules_check, nil, admin_rules_path),
|
sign_in(user)
|
||||||
Admin::SystemCheck::Message.new(:sidekiq_process_check, 'foo, bar'),
|
|
||||||
])
|
|
||||||
sign_in Fabricate(:user, role: UserRole.find_by(name: 'Admin'))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns 200' do
|
it 'returns http success and body with system check messages' do
|
||||||
get :index
|
get :index
|
||||||
|
|
||||||
expect(response).to have_http_status(200)
|
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,
|
||||||
|
]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue