diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-19 14:01:45 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-19 14:01:45 +0300 |
commit | 9297025d0b7ddf095eb618dfaaab2ff8f2018d8b (patch) | |
tree | 865198c01d1824a9b098127baa3ab980c9cd2c06 /spec/views/shared/snippets/_snippet.html.haml_spec.rb | |
parent | 6372471f43ee03c05a7c1f8b0c6ac6b8a7431dbe (diff) |
Add latest changes from gitlab-org/gitlab@16-7-stable-eev16.7.0-rc42
Diffstat (limited to 'spec/views/shared/snippets/_snippet.html.haml_spec.rb')
-rw-r--r-- | spec/views/shared/snippets/_snippet.html.haml_spec.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/views/shared/snippets/_snippet.html.haml_spec.rb b/spec/views/shared/snippets/_snippet.html.haml_spec.rb index 712021ec1e1..71ef97b0448 100644 --- a/spec/views/shared/snippets/_snippet.html.haml_spec.rb +++ b/spec/views/shared/snippets/_snippet.html.haml_spec.rb @@ -49,4 +49,37 @@ RSpec.describe 'shared/snippets/_snippet.html.haml' do expect(rendered).not_to have_selector('span.file_count') end end + + context 'spam icon and tooltip', feature_category: :insider_threat do + context 'when the author of the snippet is not banned' do + before do + render 'shared/snippets/snippet', snippet: snippet + end + + it 'does not render spam icon' do + expect(rendered).not_to have_css('[data-testid="spam-icon"]') + end + + it 'does not render tooltip' do + expect(rendered).not_to have_selector("span.has-tooltip") + end + end + + context 'when the author of the snippet is banned' do + let_it_be(:banned_user) { create(:user, :banned) } + let_it_be(:snippet) { create(:snippet, author: banned_user) } + + before do + render 'shared/snippets/snippet', snippet: snippet + end + + it 'renders spam icon' do + expect(rendered).to have_css('[data-testid="spam-icon"]') + end + + it 'renders tooltip' do + expect(rendered).to have_selector("span.has-tooltip[title='This snippet is hidden because its author has been banned']") + end + end + end end |