diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-07 12:09:34 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-07 12:09:34 +0000 |
commit | 903ccf7c93eb9490c76857bffe744249cc07de09 (patch) | |
tree | 603a3162e91999160e4efc74f351f9405f422d61 /spec/helpers | |
parent | 41cb558299b483b44b45351730ee4c0e9fe4ca2c (diff) | |
download | gitlab-ce-903ccf7c93eb9490c76857bffe744249cc07de09.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/helpers')
-rw-r--r-- | spec/helpers/environments_helper_spec.rb | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/spec/helpers/environments_helper_spec.rb b/spec/helpers/environments_helper_spec.rb index aaa90a7d2af..152e9c84ec5 100644 --- a/spec/helpers/environments_helper_spec.rb +++ b/spec/helpers/environments_helper_spec.rb @@ -34,7 +34,10 @@ describe EnvironmentsHelper do 'has-metrics' => "#{environment.has_metrics?}", 'prometheus-status' => "#{environment.prometheus_status}", 'external-dashboard-url' => nil, - 'environment-state' => environment.state + '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' ) end @@ -58,4 +61,22 @@ describe EnvironmentsHelper do it { is_expected.to include('environment-state' => 'stopped') } end end + + describe '#custom_metrics_available?' do + subject { helper.custom_metrics_available?(project) } + + before do + project.add_maintainer(user) + + allow(helper).to receive(:current_user).and_return(user) + + allow(helper).to receive(:can?) + .with(user, :admin_project, project) + .and_return(true) + end + + it 'returns true' do + expect(subject).to eq(true) + end + end end |