summaryrefslogtreecommitdiff
path: root/spec/helpers/environments_helper_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/helpers/environments_helper_spec.rb')
-rw-r--r--spec/helpers/environments_helper_spec.rb18
1 files changed, 17 insertions, 1 deletions
diff --git a/spec/helpers/environments_helper_spec.rb b/spec/helpers/environments_helper_spec.rb
index 152e9c84ec5..0756e0162a5 100644
--- a/spec/helpers/environments_helper_spec.rb
+++ b/spec/helpers/environments_helper_spec.rb
@@ -37,10 +37,26 @@ describe EnvironmentsHelper do
'environment-state' => environment.state,
'custom-metrics-path' => project_prometheus_metrics_path(project),
'validate-query-path' => validate_query_project_prometheus_metrics_path(project),
- 'custom-metrics-available' => 'true'
+ 'custom-metrics-available' => 'true',
+ 'alerts-endpoint' => project_prometheus_alerts_path(project, environment_id: environment.id, format: :json),
+ 'prometheus-alerts-available' => 'true'
)
end
+ context 'without read_prometheus_alerts permission' do
+ before do
+ allow(helper).to receive(:can?)
+ .with(user, :read_prometheus_alerts, project)
+ .and_return(false)
+ end
+
+ it 'returns false' do
+ expect(metrics_data).to include(
+ 'prometheus-alerts-available' => 'false'
+ )
+ end
+ end
+
context 'with metrics_setting' do
before do
create(:project_metrics_setting, project: project, external_dashboard_url: 'http://gitlab.com')