diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-09 03:10:52 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-09 03:10:52 +0300 |
commit | 60c4a86ee6faf8209d3896eec65860dd8b69563c (patch) | |
tree | 2d952d8813ac96db94b850fe70f00f1cb927742d /spec/controllers | |
parent | 58cad9b83fc4b319542586e2cab64e2fe7d12050 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/search_controller_spec.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/controllers/search_controller_spec.rb b/spec/controllers/search_controller_spec.rb index 82b7c1ba927..10fe15558c5 100644 --- a/spec/controllers/search_controller_spec.rb +++ b/spec/controllers/search_controller_spec.rb @@ -189,6 +189,25 @@ RSpec.describe SearchController, feature_category: :global_search do end end + context 'when allow_anonymous_searches is disabled' do + before do + stub_feature_flags(allow_anonymous_searches: false) + end + + context 'for unauthenticated user' do + before do + sign_out(user) + end + + it 'redirects to login page' do + get :show, params: { scope: 'projects', search: '*' } + + expect(response).to redirect_to new_user_session_path + expect(flash[:alert]).to match(/You must be logged in/) + end + end + end + context 'tab feature flags' do subject { get :show, params: { scope: scope, search: 'term' }, format: :html } |