diff options
Diffstat (limited to 'spec/requests/api/metrics/dashboard')
-rw-r--r-- | spec/requests/api/metrics/dashboard/annotations_spec.rb | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/spec/requests/api/metrics/dashboard/annotations_spec.rb b/spec/requests/api/metrics/dashboard/annotations_spec.rb index 7932dd29e4d..250fe2a3ee3 100644 --- a/spec/requests/api/metrics/dashboard/annotations_spec.rb +++ b/spec/requests/api/metrics/dashboard/annotations_spec.rb @@ -16,6 +16,7 @@ RSpec.describe API::Metrics::Dashboard::Annotations, feature_category: :metrics let(:url) { "/#{source_type.pluralize}/#{source.id}/metrics_dashboard/annotations" } before do + stub_feature_flags(remove_monitor_metrics: false) project.add_developer(user) end @@ -35,7 +36,7 @@ RSpec.describe API::Metrics::Dashboard::Annotations, feature_category: :metrics end context 'with invalid parameters' do - it 'returns error messsage' do + it 'returns error message' do post api(url, user), params: { dashboard_path: '', starting_at: nil, description: nil } expect(response).to have_gitlab_http_status(:bad_request) @@ -104,6 +105,18 @@ RSpec.describe API::Metrics::Dashboard::Annotations, feature_category: :metrics expect(response).to have_gitlab_http_status(:forbidden) end end + + context 'when metrics dashboard feature is unavailable' do + before do + stub_feature_flags(remove_monitor_metrics: true) + end + + it 'returns 404 not found' do + post api(url, user), params: params + + expect(response).to have_gitlab_http_status(:not_found) + end + end end end |