diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-04 00:09:37 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-04 00:09:37 +0000 |
commit | e3bdfa1a13d7e6c92716324c78b5b20c07eeb7c6 (patch) | |
tree | e8776263096b027d32d4be5118cccc87b00de2bc /spec/services/metrics | |
parent | c1a50b8195f4e36fda9b233acbde57a449bcf6c3 (diff) | |
download | gitlab-ce-e3bdfa1a13d7e6c92716324c78b5b20c07eeb7c6.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services/metrics')
-rw-r--r-- | spec/services/metrics/dashboard/update_dashboard_service_spec.rb | 36 |
1 files changed, 4 insertions, 32 deletions
diff --git a/spec/services/metrics/dashboard/update_dashboard_service_spec.rb b/spec/services/metrics/dashboard/update_dashboard_service_spec.rb index 72d36959bce..fce027688d9 100644 --- a/spec/services/metrics/dashboard/update_dashboard_service_spec.rb +++ b/spec/services/metrics/dashboard/update_dashboard_service_spec.rb @@ -27,14 +27,7 @@ describe Metrics::Dashboard::UpdateDashboardService, :use_clean_rails_memory_sto end context 'user does not have push right to repository' do - it 'returns an appropriate message and status code', :aggregate_failures do - result = service_call - - expect(result.keys).to contain_exactly(:message, :http_status, :status, :last_step) - expect(result[:status]).to eq(:error) - expect(result[:http_status]).to eq(:forbidden) - expect(result[:message]).to eq("You are not allowed to push into this branch. Create another branch or open a merge request.") - end + it_behaves_like 'misconfigured dashboard service response with stepable', :forbidden, 'You are not allowed to push into this branch. Create another branch or open a merge request.' end context 'with rights to push to the repository' do @@ -46,27 +39,13 @@ describe Metrics::Dashboard::UpdateDashboardService, :use_clean_rails_memory_sto context 'with a yml extension' do let(:file_name) { 'config/prometheus/../database.yml' } - it 'returns an appropriate message and status code', :aggregate_failures do - result = service_call - - expect(result.keys).to contain_exactly(:message, :http_status, :status, :last_step) - expect(result[:status]).to eq(:error) - expect(result[:http_status]).to eq(:bad_request) - expect(result[:message]).to eq("A file with this name doesn't exist") - end + it_behaves_like 'misconfigured dashboard service response with stepable', :bad_request, "A file with this name doesn't exist" end context 'without a yml extension' do let(:file_name) { '../../..../etc/passwd' } - it 'returns an appropriate message and status code', :aggregate_failures do - result = service_call - - expect(result.keys).to contain_exactly(:message, :http_status, :status, :last_step) - expect(result[:status]).to eq(:error) - expect(result[:http_status]).to eq(:bad_request) - expect(result[:message]).to eq("The file name should have a .yml extension") - end + it_behaves_like 'misconfigured dashboard service response with stepable', :bad_request, 'The file name should have a .yml extension' end end @@ -81,14 +60,7 @@ describe Metrics::Dashboard::UpdateDashboardService, :use_clean_rails_memory_sto project.repository.add_branch(user, branch, 'master') end - it 'returns an appropriate message and status code', :aggregate_failures do - result = service_call - - expect(result.keys).to contain_exactly(:message, :http_status, :status, :last_step) - expect(result[:status]).to eq(:error) - expect(result[:http_status]).to eq(:bad_request) - expect(result[:message]).to eq("There was an error updating the dashboard, branch named: existing_branch already exists.") - end + it_behaves_like 'misconfigured dashboard service response with stepable', :bad_request, 'There was an error updating the dashboard, branch named: existing_branch already exists.' end context 'Files::UpdateService success' do |