diff options
author | YarNayar <YarTheGreat@gmail.com> | 2017-01-11 07:20:32 +0300 |
---|---|---|
committer | YarNayar <YarTheGreat@gmail.com> | 2017-01-24 14:58:00 +0300 |
commit | 99404a5851a4b8bbba8a5786d7351f2d4b024092 (patch) | |
tree | b79389d46bd60d1ba9c7ca0c87fa76e0061700c2 /spec | |
parent | dd3ddcd72bbfec3ba5bbcd871a9ac68064be7501 (diff) | |
download | gitlab-ce-99404a5851a4b8bbba8a5786d7351f2d4b024092.tar.gz |
Search feature: redirects to commit page if query is commit sha and only commit found
See !8028 and #24833
Diffstat (limited to 'spec')
-rw-r--r-- | spec/features/search_spec.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/features/search_spec.rb b/spec/features/search_spec.rb index c64aeea0612..0fe5a897565 100644 --- a/spec/features/search_spec.rb +++ b/spec/features/search_spec.rb @@ -217,6 +217,31 @@ describe "Search", feature: true do visit search_path(project_id: project.id) end + it 'redirects to commit page when search by sha and only commit found' do + fill_in 'search', with: '6d394385cf567f80a8fd85055db1ab4c5295806f' + + click_button 'Search' + + expect(page).to have_current_path(namespace_project_commit_path(project.namespace, project, '6d394385cf567f80a8fd85055db1ab4c5295806f')) + end + + it 'redirects to single commit regardless of query case' do + fill_in 'search', with: '6D394385cf' + + click_button 'Search' + + expect(page).to have_current_path(namespace_project_commit_path(project.namespace, project, '6d394385cf567f80a8fd85055db1ab4c5295806f')) + end + + it 'holds on /search page when the only commit is found by message' do + create_commit('Message referencing another sha: "deadbeef" ', project, user, 'master') + + fill_in 'search', with: 'deadbeef' + click_button 'Search' + + expect(page).to have_current_path('/search', only_path: true) + end + it 'shows multiple matching commits' do fill_in 'search', with: 'See merge request' |