summaryrefslogtreecommitdiff
path: root/spec/support/shared_examples/controllers/issuable_anonymous_search_disabled_examples.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-02-20 13:49:51 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2023-02-20 13:49:51 +0000
commit71786ddc8e28fbd3cb3fcc4b3ff15e5962a1c82e (patch)
tree6a2d93ef3fb2d353bb7739e4b57e6541f51cdd71 /spec/support/shared_examples/controllers/issuable_anonymous_search_disabled_examples.rb
parenta7253423e3403b8c08f8a161e5937e1488f5f407 (diff)
downloadgitlab-ce-15.9.0-rc42.tar.gz
Add latest changes from gitlab-org/gitlab@15-9-stable-eev15.9.0-rc42
Diffstat (limited to 'spec/support/shared_examples/controllers/issuable_anonymous_search_disabled_examples.rb')
-rw-r--r--spec/support/shared_examples/controllers/issuable_anonymous_search_disabled_examples.rb55
1 files changed, 0 insertions, 55 deletions
diff --git a/spec/support/shared_examples/controllers/issuable_anonymous_search_disabled_examples.rb b/spec/support/shared_examples/controllers/issuable_anonymous_search_disabled_examples.rb
deleted file mode 100644
index e77acb93798..00000000000
--- a/spec/support/shared_examples/controllers/issuable_anonymous_search_disabled_examples.rb
+++ /dev/null
@@ -1,55 +0,0 @@
-# frozen_string_literal: true
-
-RSpec.shared_examples 'issuable list with anonymous search disabled' do |action|
- let(:controller_action) { :index }
- let(:params_with_search) { params.merge(search: 'some search term') }
-
- context 'when disable_anonymous_search is enabled' do
- before do
- stub_feature_flags(disable_anonymous_search: true)
- end
-
- it 'shows a flash message' do
- get controller_action, params: params_with_search
-
- expect(flash.now[:notice]).to eq('You must sign in to search for specific terms.')
- end
-
- context 'when search param is not given' do
- it 'does not show a flash message' do
- get controller_action, params: params
-
- expect(flash.now[:notice]).to be_nil
- end
- end
-
- context 'when user is signed-in' do
- it 'does not show a flash message' do
- sign_in(create(:user))
- get controller_action, params: params_with_search
-
- expect(flash.now[:notice]).to be_nil
- end
- end
-
- context 'when format is not HTML' do
- it 'does not show a flash message' do
- get controller_action, params: params_with_search.merge(format: :atom)
-
- expect(flash.now[:notice]).to be_nil
- end
- end
- end
-
- context 'when disable_anonymous_search is disabled' do
- before do
- stub_feature_flags(disable_anonymous_search: false)
- end
-
- it 'does not show a flash message' do
- get controller_action, params: params_with_search
-
- expect(flash.now[:notice]).to be_nil
- end
- end
-end