summaryrefslogtreecommitdiff
path: root/spec/features
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2017-01-24 13:48:33 +0000
committerSean McGivern <sean@mcgivern.me.uk>2017-01-24 13:48:33 +0000
commit65bf7e0d92856d90215ca908751e676393c10618 (patch)
treefebf109d5461c13b856d7a8e3c51cdd2fa1beb18 /spec/features
parenta89aab9c630593524b8a210746d2eb680ac5d102 (diff)
parent99404a5851a4b8bbba8a5786d7351f2d4b024092 (diff)
downloadgitlab-ce-65bf7e0d92856d90215ca908751e676393c10618.tar.gz
Merge branch '24833-Allow-to-search-by-commit-hash-within-project' into 'master'
Allows to search within project by commit's hash #24833 Closes #24833 See merge request !8028
Diffstat (limited to 'spec/features')
-rw-r--r--spec/features/search_spec.rb40
1 files changed, 40 insertions, 0 deletions
diff --git a/spec/features/search_spec.rb b/spec/features/search_spec.rb
index a05b83959fb..0fe5a897565 100644
--- a/spec/features/search_spec.rb
+++ b/spec/features/search_spec.rb
@@ -211,4 +211,44 @@ describe "Search", feature: true do
end
end
end
+
+ describe 'search for commits' do
+ before 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'
+
+ click_button 'Search'
+ click_link 'Commits'
+
+ expect(page).to have_selector('.commit-row-description', count: 9)
+ end
+ end
end