diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-11 15:08:50 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-11 15:08:50 +0300 |
commit | 0eaa82ad61d2fda42b2dd5cf58cc08654b2d69ef (patch) | |
tree | 9ab5c60316dd689e0ac53830fd3910817006c9b3 /spec/features/search | |
parent | 6b5f961bef87c70effe57b14d41f9ed882b5d296 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features/search')
-rw-r--r-- | spec/features/search/user_searches_for_issues_spec.rb | 33 | ||||
-rw-r--r-- | spec/features/search/user_searches_for_projects_spec.rb | 45 |
2 files changed, 52 insertions, 26 deletions
diff --git a/spec/features/search/user_searches_for_issues_spec.rb b/spec/features/search/user_searches_for_issues_spec.rb index d895e87f1cb..900ed35adea 100644 --- a/spec/features/search/user_searches_for_issues_spec.rb +++ b/spec/features/search/user_searches_for_issues_spec.rb @@ -86,20 +86,33 @@ RSpec.describe 'User searches for issues', :js do end context 'when signed out' do - let(:project) { create(:project, :public) } + context 'when block_anonymous_global_searches is disabled' do + let(:project) { create(:project, :public) } - before do - visit(search_path) - end + before do + stub_feature_flags(block_anonymous_global_searches: false) + visit(search_path) + end - include_examples 'top right search form' + include_examples 'top right search form' - it 'finds an issue' do - search_for_issue(issue1.title) + it 'finds an issue' do + search_for_issue(issue1.title) - page.within('.results') do - expect(page).to have_link(issue1.title) - expect(page).not_to have_link(issue2.title) + page.within('.results') do + expect(page).to have_link(issue1.title) + expect(page).not_to have_link(issue2.title) + end + end + end + + context 'when block_anonymous_global_searches is enabled' do + before do + visit(search_path) + end + + it 'is redirected to login page' do + expect(page).to have_content('You must be logged in to search across all of GitLab') end end end diff --git a/spec/features/search/user_searches_for_projects_spec.rb b/spec/features/search/user_searches_for_projects_spec.rb index 7bb5a4da7d0..b64909dd42f 100644 --- a/spec/features/search/user_searches_for_projects_spec.rb +++ b/spec/features/search/user_searches_for_projects_spec.rb @@ -6,31 +6,44 @@ RSpec.describe 'User searches for projects' do let!(:project) { create(:project, :public, name: 'Shop') } context 'when signed out' do - include_examples 'top right search form' + context 'when block_anonymous_global_searches is disabled' do + before do + stub_feature_flags(block_anonymous_global_searches: false) + end - it 'finds a project' do - visit(search_path) + include_examples 'top right search form' - fill_in('dashboard_search', with: project.name[0..3]) - click_button('Search') + it 'finds a project' do + visit(search_path) - expect(page).to have_link(project.name) - end + fill_in('dashboard_search', with: project.name[0..3]) + click_button('Search') - it 'preserves the group being searched in' do - visit(search_path(group_id: project.namespace.id)) + expect(page).to have_link(project.name) + end - submit_search('foo') + it 'preserves the group being searched in' do + visit(search_path(group_id: project.namespace.id)) - expect(find('#group_id', visible: false).value).to eq(project.namespace.id.to_s) - end + submit_search('foo') + + expect(find('#group_id', visible: false).value).to eq(project.namespace.id.to_s) + end - it 'preserves the project being searched in' do - visit(search_path(project_id: project.id)) + it 'preserves the project being searched in' do + visit(search_path(project_id: project.id)) - submit_search('foo') + submit_search('foo') + + expect(find('#project_id', visible: false).value).to eq(project.id.to_s) + end + end - expect(find('#project_id', visible: false).value).to eq(project.id.to_s) + context 'when block_anonymous_global_searches is enabled' do + it 'is redirected to login page' do + visit(search_path) + expect(page).to have_content('You must be logged in to search across all of GitLab') + end end end end |