diff options
Diffstat (limited to 'spec/lib/gitlab/danger/helper_spec.rb')
-rw-r--r-- | spec/lib/gitlab/danger/helper_spec.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/lib/gitlab/danger/helper_spec.rb b/spec/lib/gitlab/danger/helper_spec.rb index 1696d3566ad..3ffb6c29a96 100644 --- a/spec/lib/gitlab/danger/helper_spec.rb +++ b/spec/lib/gitlab/danger/helper_spec.rb @@ -312,4 +312,26 @@ describe Gitlab::Danger::Helper do it { is_expected.to match_array(['database', 'database::review pending']) } end end + + describe '#security_mr?' do + it 'returns false when `gitlab_helper` is unavailable' do + expect(helper).to receive(:gitlab_helper).and_return(nil) + + expect(helper).not_to be_security_mr + end + + it 'returns false when on a normal merge request' do + expect(fake_gitlab).to receive(:mr_json) + .and_return('web_url' => 'https://gitlab.com/gitlab-org/gitlab/merge_requests/1') + + expect(helper).not_to be_security_mr + end + + it 'returns true when on a security merge request' do + expect(fake_gitlab).to receive(:mr_json) + .and_return('web_url' => 'https://gitlab.com/gitlab-org/security/gitlab/merge_requests/1') + + expect(helper).to be_security_mr + end + end end |