Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/views/shared')
-rw-r--r--spec/views/shared/nav/_sidebar.html.haml_spec.rb43
-rw-r--r--spec/views/shared/runners/_runner_details.html.haml_spec.rb2
-rw-r--r--spec/views/shared/snippets/_snippet.html.haml_spec.rb33
3 files changed, 34 insertions, 44 deletions
diff --git a/spec/views/shared/nav/_sidebar.html.haml_spec.rb b/spec/views/shared/nav/_sidebar.html.haml_spec.rb
deleted file mode 100644
index 0eb945f5624..00000000000
--- a/spec/views/shared/nav/_sidebar.html.haml_spec.rb
+++ /dev/null
@@ -1,43 +0,0 @@
-# frozen_string_literal: true
-
-require 'spec_helper'
-
-RSpec.describe 'shared/nav/_sidebar.html.haml' do
- let_it_be(:project) { create(:project) }
-
- let(:context) { Sidebars::Projects::Context.new(current_user: nil, container: project) }
- let(:sidebar) { Sidebars::Projects::Panel.new(context) }
-
- before do
- assign(:project, project)
- assign(:sidebar, sidebar)
-
- allow(sidebar).to receive(:renderable_menus).and_return([])
- end
-
- context 'when sidebar has a scope menu' do
- it 'renders the scope menu' do
- render
-
- expect(rendered).to render_template('shared/nav/_scope_menu')
- end
- end
-
- context 'when sidebar does not have a scope menu' do
- let(:scope_menu_view_path) { 'shared/nav/' }
- let(:scope_menu_view_name) { 'scope_menu.html.haml' }
- let(:scope_menu_partial) { "#{scope_menu_view_path}_#{scope_menu_view_name}" }
- let(:content) { 'Custom test content' }
-
- context 'when sidebar has a custom scope menu partial defined' do
- it 'renders the custom partial' do
- allow(view).to receive(:scope_menu).and_return(nil)
- stub_template(scope_menu_partial => content)
-
- render
-
- expect(rendered).to have_text(content)
- end
- end
- end
-end
diff --git a/spec/views/shared/runners/_runner_details.html.haml_spec.rb b/spec/views/shared/runners/_runner_details.html.haml_spec.rb
index a597c719d87..0612d157ff4 100644
--- a/spec/views/shared/runners/_runner_details.html.haml_spec.rb
+++ b/spec/views/shared/runners/_runner_details.html.haml_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-RSpec.describe 'shared/runners/_runner_details.html.haml', feature_category: :runner_fleet do
+RSpec.describe 'shared/runners/_runner_details.html.haml', feature_category: :fleet_visibility do
include PageLayoutHelper
let_it_be(:runner) do
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