mirror of
https://github.com/mastodon/mastodon.git
synced 2024-05-18 01:52:43 +00:00
Verify response body contents with a system check
This commit is contained in:
parent
eeae6abaef
commit
8a100d0003
|
@ -6,20 +6,34 @@ describe Admin::DashboardController do
|
|||
render_views
|
||||
|
||||
describe 'GET #index' do
|
||||
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) }
|
||||
|
||||
before do
|
||||
allow(Admin::SystemCheck).to receive(:perform).and_return(system_check_messages_for_test_env)
|
||||
sign_in Fabricate(:user, role: UserRole.find_by(name: 'Admin'))
|
||||
stub_system_check_with_safe_results
|
||||
sign_in(user)
|
||||
end
|
||||
|
||||
it 'returns 200' do
|
||||
it 'returns http success' do
|
||||
get :index
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response)
|
||||
.to have_http_status(200)
|
||||
|
||||
expect(response.body)
|
||||
.to include(
|
||||
I18n.t('admin.system_checks.database_schema_check.message_html')
|
||||
)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def system_check_messages_for_test_env
|
||||
def stub_system_check_with_safe_results
|
||||
allow(Admin::SystemCheck)
|
||||
.to receive(:perform)
|
||||
.and_return(safe_system_check_messages)
|
||||
end
|
||||
|
||||
def safe_system_check_messages
|
||||
[
|
||||
Admin::SystemCheck::Message.new(:database_schema_check),
|
||||
Admin::SystemCheck::Message.new(:rules_check, nil, admin_rules_path),
|
||||
|
|
Loading…
Reference in a new issue