summaryrefslogtreecommitdiff
path: root/spec/support/shared_examples/controllers/metrics_dashboard_shared_examples.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/support/shared_examples/controllers/metrics_dashboard_shared_examples.rb')
-rw-r--r--spec/support/shared_examples/controllers/metrics_dashboard_shared_examples.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/support/shared_examples/controllers/metrics_dashboard_shared_examples.rb b/spec/support/shared_examples/controllers/metrics_dashboard_shared_examples.rb
index cb8f6721d66..5b63ef10c85 100644
--- a/spec/support/shared_examples/controllers/metrics_dashboard_shared_examples.rb
+++ b/spec/support/shared_examples/controllers/metrics_dashboard_shared_examples.rb
@@ -17,6 +17,10 @@ RSpec.shared_examples_for 'GET #metrics_dashboard for dashboard' do |dashboard_n
let(:expected_keys) { %w(dashboard status metrics_data) }
let(:status_code) { :ok }
+ before do
+ stub_feature_flags(remove_monitor_metrics: false)
+ end
+
it_behaves_like 'GET #metrics_dashboard correctly formatted response'
it 'returns correct dashboard' do
@@ -24,4 +28,17 @@ RSpec.shared_examples_for 'GET #metrics_dashboard for dashboard' do |dashboard_n
expect(json_response['dashboard']['dashboard']).to eq(dashboard_name)
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
+ get :metrics_dashboard, params: metrics_dashboard_req_params, format: :json
+
+ expect(response).to have_gitlab_http_status(:not_found)
+ expect(response.body).to be_empty
+ end
+ end
end