summaryrefslogtreecommitdiff
path: root/spec/frontend/fixtures/metrics_dashboard.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/fixtures/metrics_dashboard.rb')
-rw-r--r--spec/frontend/fixtures/metrics_dashboard.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/spec/frontend/fixtures/metrics_dashboard.rb b/spec/frontend/fixtures/metrics_dashboard.rb
index b5dee7525f6..6ee730f5c3d 100644
--- a/spec/frontend/fixtures/metrics_dashboard.rb
+++ b/spec/frontend/fixtures/metrics_dashboard.rb
@@ -6,10 +6,11 @@ RSpec.describe MetricsDashboard, '(JavaScript fixtures)', type: :controller do
include JavaScriptFixturesHelpers
include MetricsDashboardHelpers
- let(:user) { create(:user) }
- let(:project) { project_with_dashboard('.gitlab/dashboards/test.yml') }
- let(:environment) { create(:environment, project: project) }
- let(:params) { { environment: environment } }
+ let_it_be(:user) { create(:user) }
+ let_it_be(:namespace) { create(:namespace, name: 'monitoring' )}
+ let_it_be(:project) { project_with_dashboard_namespace('.gitlab/dashboards/test.yml', namespace: namespace) }
+ let_it_be(:environment) { create(:environment, id: 1, project: project) }
+ let_it_be(:params) { { environment: environment } }
before(:all) do
clean_frontend_fixtures('metrics_dashboard/')
@@ -24,6 +25,7 @@ RSpec.describe MetricsDashboard, '(JavaScript fixtures)', type: :controller do
project.add_maintainer(user)
allow(controller).to receive(:project).and_return(project)
+ allow(controller).to receive(:environment).and_return(environment)
allow(controller)
.to receive(:metrics_dashboard_params)
.and_return(params)
@@ -35,7 +37,9 @@ RSpec.describe MetricsDashboard, '(JavaScript fixtures)', type: :controller do
it 'metrics_dashboard/environment_metrics_dashboard.json' do
routes.draw { get "metrics_dashboard" => "anonymous#metrics_dashboard" }
+
response = get :metrics_dashboard, format: :json
+
expect(response).to be_successful
end
end