diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 13:00:54 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 13:00:54 +0300 |
commit | 3cccd102ba543e02725d247893729e5c73b38295 (patch) | |
tree | f36a04ec38517f5deaaacb5acc7d949688d1e187 /spec/helpers/projects/alert_management_helper_spec.rb | |
parent | 205943281328046ef7b4528031b90fbda70c75ac (diff) |
Add latest changes from gitlab-org/gitlab@14-10-stable-eev14.10.0-rc42
Diffstat (limited to 'spec/helpers/projects/alert_management_helper_spec.rb')
-rw-r--r-- | spec/helpers/projects/alert_management_helper_spec.rb | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/spec/helpers/projects/alert_management_helper_spec.rb b/spec/helpers/projects/alert_management_helper_spec.rb index 0a5c4bedaa6..a78a8add336 100644 --- a/spec/helpers/projects/alert_management_helper_spec.rb +++ b/spec/helpers/projects/alert_management_helper_spec.rb @@ -110,15 +110,34 @@ RSpec.describe Projects::AlertManagementHelper do describe '#alert_management_detail_data' do let(:alert_id) { 1 } let(:issues_path) { project_issues_path(project) } + let(:can_update_alert) { true } + + before do + allow(helper) + .to receive(:can?) + .with(current_user, :update_alert_management_alert, project) + .and_return(can_update_alert) + end it 'returns detail page configuration' do - expect(helper.alert_management_detail_data(project, alert_id)).to eq( + expect(helper.alert_management_detail_data(current_user, project, alert_id)).to eq( 'alert-id' => alert_id, 'project-path' => project_path, 'project-id' => project_id, 'project-issues-path' => issues_path, - 'page' => 'OPERATIONS' + 'page' => 'OPERATIONS', + 'can-update' => 'true' ) end + + context 'when user cannot update alert' do + let(:can_update_alert) { false } + + it 'shows error tracking enablement as disabled' do + expect(helper.alert_management_detail_data(current_user, project, alert_id)).to include( + 'can-update' => 'false' + ) + end + end end end |