diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-11-17 18:15:43 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-11-17 18:15:43 +0300 |
commit | 843b1e9386fbda332839d23246d0ee2382fb7f4c (patch) | |
tree | 7663f7e38aa4e018c7210a9abdfddcd83a8bcbce /spec/views | |
parent | 2724004cd7b8fa9d179c926c62f2fd7be63c2d81 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/views')
-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 |