diff options
author | syasonik <syasonik@gitlab.com> | 2019-04-22 14:23:35 +0800 |
---|---|---|
committer | syasonik <syasonik@gitlab.com> | 2019-04-24 18:23:04 +0800 |
commit | a08d4cad90f98169339a3793d18f1bae4e46ad83 (patch) | |
tree | 91238d10798fe5e896f05fe8c8d83e388706e6e0 /spec/controllers | |
parent | 25f957711dac1d401982c18da439580b2e9912c9 (diff) | |
download | gitlab-ce-a08d4cad90f98169339a3793d18f1bae4e46ad83.tar.gz |
Defend against dashboard errors, rework sequence
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/projects/environments_controller_spec.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/controllers/projects/environments_controller_spec.rb b/spec/controllers/projects/environments_controller_spec.rb index 6c3aad55622..b43698a6ef7 100644 --- a/spec/controllers/projects/environments_controller_spec.rb +++ b/spec/controllers/projects/environments_controller_spec.rb @@ -482,6 +482,19 @@ describe Projects::EnvironmentsController do expect(json_response.keys).to contain_exactly('dashboard', 'status') expect(json_response['dashboard']).to be_an_instance_of(Hash) end + + context 'when the dashboard could not be provided' do + before do + allow(YAML).to receive(:load_file).and_return({}) + end + + it 'returns an error response' do + get :metrics_dashboard, params: environment_params(format: :json) + + expect(response).to have_gitlab_http_status(:unprocessable_entity) + expect(json_response.keys).to contain_exactly('message', 'status', 'http_status') + end + end end end |