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/controllers/search_controller_spec.rb')
-rw-r--r--spec/controllers/search_controller_spec.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/controllers/search_controller_spec.rb b/spec/controllers/search_controller_spec.rb
index e0870e17d99..4e87a9fc1ba 100644
--- a/spec/controllers/search_controller_spec.rb
+++ b/spec/controllers/search_controller_spec.rb
@@ -182,6 +182,37 @@ RSpec.describe SearchController do
end
end
end
+
+ context 'tab feature flags' do
+ subject { get :show, params: { scope: scope, search: 'term' }, format: :html }
+
+ where(:feature_flag, :scope) do
+ :global_search_code_tab | 'blobs'
+ :global_search_issues_tab | 'issues'
+ :global_search_merge_requests_tab | 'merge_requests'
+ :global_search_wiki_tab | 'wiki_blobs'
+ :global_search_commits_tab | 'commits'
+ end
+
+ with_them do
+ it 'returns 200 if flag is enabled' do
+ stub_feature_flags(feature_flag => true)
+
+ subject
+
+ expect(response).to have_gitlab_http_status(:ok)
+ end
+
+ it 'redirects with alert if flag is disabled' do
+ stub_feature_flags(feature_flag => false)
+
+ subject
+
+ expect(response).to redirect_to search_path
+ expect(controller).to set_flash[:alert].to(/Global Search is disabled for this scope/)
+ end
+ end
+ end
end
it 'finds issue comments' do