diff options
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 |