diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-10 03:10:29 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-10 03:10:29 +0300 |
commit | 981771279a48c03263e29f3b4f41f54204ea3146 (patch) | |
tree | 5e48e8debb84850147d183b094ffcd9d8b084c48 /spec/helpers | |
parent | a8648ba08604085c76be1e4f5253ffa89aa192e3 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/helpers')
-rw-r--r-- | spec/helpers/snippets_helper_spec.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/helpers/snippets_helper_spec.rb b/spec/helpers/snippets_helper_spec.rb index 35882c9337b..12d791d8710 100644 --- a/spec/helpers/snippets_helper_spec.rb +++ b/spec/helpers/snippets_helper_spec.rb @@ -92,4 +92,23 @@ RSpec.describe SnippetsHelper do end end end + + describe '#snippet_report_abuse_path' do + let(:snippet) { public_personal_snippet } + let(:current_user) { create(:user) } + + subject { snippet_report_abuse_path(snippet) } + + it 'returns false if the user cannot submit the snippet as spam' do + allow(snippet).to receive(:submittable_as_spam_by?).and_return(false) + + expect(subject).to be_falsey + end + + it 'returns true if the user can submit the snippet as spam' do + allow(snippet).to receive(:submittable_as_spam_by?).and_return(true) + + expect(subject).to be_truthy + end + end end |