diff options
Diffstat (limited to 'spec/features/search/user_searches_for_commits_spec.rb')
-rw-r--r-- | spec/features/search/user_searches_for_commits_spec.rb | 72 |
1 files changed, 33 insertions, 39 deletions
diff --git a/spec/features/search/user_searches_for_commits_spec.rb b/spec/features/search/user_searches_for_commits_spec.rb index 1fd62a01c78..724daf9277d 100644 --- a/spec/features/search/user_searches_for_commits_spec.rb +++ b/spec/features/search/user_searches_for_commits_spec.rb @@ -3,61 +3,55 @@ require 'spec_helper' RSpec.describe 'User searches for commits', :js, :clean_gitlab_redis_rate_limiting, feature_category: :global_search do - using RSpec::Parameterized::TableSyntax - let_it_be(:user) { create(:user) } + let_it_be(:project) { create(:project, :repository) } - let(:project) { create(:project, :repository) } let(:sha) { '6d394385cf567f80a8fd85055db1ab4c5295806f' } - where(search_page_vertical_nav_enabled: [true, false]) - with_them do - before do - stub_feature_flags(search_page_vertical_nav: search_page_vertical_nav_enabled) - project.add_reporter(user) - sign_in(user) + before do + project.add_reporter(user) + sign_in(user) - visit(search_path(project_id: project.id)) - end + visit(search_path(project_id: project.id)) + end - include_examples 'search timeouts', 'commits' do - let(:additional_params) { { project_id: project.id } } - end + include_examples 'search timeouts', 'commits' do + let(:additional_params) { { project_id: project.id } } + end - context 'when searching by SHA' do - it 'finds a commit and redirects to its page' do - submit_search(sha) + context 'when searching by SHA' do + it 'finds a commit and redirects to its page' do + submit_search(sha) - expect(page).to have_current_path(project_commit_path(project, sha)) - end + expect(page).to have_current_path(project_commit_path(project, sha)) + end - it 'finds a commit in uppercase and redirects to its page' do - submit_search(sha.upcase) + it 'finds a commit in uppercase and redirects to its page' do + submit_search(sha.upcase) - expect(page).to have_current_path(project_commit_path(project, sha)) - end + expect(page).to have_current_path(project_commit_path(project, sha)) end + end - context 'when searching by message' do - it 'finds a commit and holds on /search page' do - project.repository.commit_files( - user, - message: 'Message referencing another sha: "deadbeef"', - branch_name: 'master', - actions: [{ action: :create, file_path: 'a/new.file', contents: 'new file' }] - ) + context 'when searching by message' do + it 'finds a commit and holds on /search page' do + project.repository.commit_files( + user, + message: 'Message referencing another sha: "deadbeef"', + branch_name: 'master', + actions: [{ action: :create, file_path: 'a/new.file', contents: 'new file' }] + ) - submit_search('deadbeef') + submit_search('deadbeef') - expect(page).to have_current_path('/search', ignore_query: true) - end + expect(page).to have_current_path('/search', ignore_query: true) + end - it 'finds multiple commits' do - submit_search('See merge request') - select_search_scope('Commits') + it 'finds multiple commits' do + submit_search('See merge request') + select_search_scope('Commits') - expect(page).to have_selector('.commit-row-description', visible: false, count: 9) - end + expect(page).to have_selector('.commit-row-description', visible: false, count: 9) end end end |