summaryrefslogtreecommitdiff
path: root/spec/features
diff options
context:
space:
mode:
authorAlexis Reigel <alexis.reigel.ext@siemens.com>2018-08-15 13:53:23 +0200
committerAlexis Reigel <alexis.reigel.ext@siemens.com>2019-03-14 18:16:03 +0100
commit22f44b50d8ece6cdb2d83cb8e2b1c5b51f01d70d (patch)
tree8bde2d73db686a43f8e8a323ea59c3992ee10550 /spec/features
parent70261ff11c93dcad30b0f4b3b61c4289d0ae1bb3 (diff)
downloadgitlab-ce-22f44b50d8ece6cdb2d83cb8e2b1c5b51f01d70d.tar.gz
add users search results to project scoped search
Diffstat (limited to 'spec/features')
-rw-r--r--spec/features/global_search_spec.rb18
-rw-r--r--spec/features/search/user_searches_for_users_spec.rb53
2 files changed, 53 insertions, 18 deletions
diff --git a/spec/features/global_search_spec.rb b/spec/features/global_search_spec.rb
index 9ecf2cab3b5..d7692181453 100644
--- a/spec/features/global_search_spec.rb
+++ b/spec/features/global_search_spec.rb
@@ -25,22 +25,4 @@ describe 'Global search' do
expect(page).to have_selector('.gl-pagination .next')
end
end
-
- describe 'users search' do
- it 'shows the found user under the Users tab' do
- create(:user, username: 'gob_bluth', name: 'Gob Bluth')
-
- visit dashboard_projects_path
-
- fill_in 'search', with: 'gob'
- click_button 'Go'
-
- expect(page).to have_content('Users 1')
-
- click_on('Users 1')
-
- expect(page).to have_content('Gob Bluth')
- expect(page).to have_content('@gob_bluth')
- end
- end
end
diff --git a/spec/features/search/user_searches_for_users_spec.rb b/spec/features/search/user_searches_for_users_spec.rb
new file mode 100644
index 00000000000..ba4b66c78cb
--- /dev/null
+++ b/spec/features/search/user_searches_for_users_spec.rb
@@ -0,0 +1,53 @@
+require 'spec_helper'
+
+describe 'User searches for users' do
+ context 'when on the dashboard' do
+ it 'finds the user' do
+ create(:user, username: 'gob_bluth', name: 'Gob Bluth')
+
+ sign_in(create(:user))
+
+ visit dashboard_projects_path
+
+ fill_in 'search', with: 'gob'
+ click_button 'Go'
+
+ expect(page).to have_content('Users 1')
+
+ click_on('Users 1')
+
+ expect(page).to have_content('Gob Bluth')
+ expect(page).to have_content('@gob_bluth')
+ end
+ end
+
+ context 'when on the project page' do
+ it 'finds the user belonging to the project' do
+ project = create(:project)
+
+ user1 = create(:user, username: 'gob_bluth', name: 'Gob Bluth')
+ create(:project_member, :developer, user: user1, project: project)
+
+ user2 = create(:user, username: 'michael_bluth', name: 'Michael Bluth')
+ create(:project_member, :developer, user: user2, project: project)
+
+ create(:user, username: 'gob_2018', name: 'George Oscar Bluth')
+
+ sign_in(user1)
+
+ visit projects_path(project)
+
+ fill_in 'search', with: 'gob'
+ click_button 'Go'
+
+ expect(page).to have_content('Gob Bluth')
+ expect(page).to have_content('@gob_bluth')
+
+ expect(page).not_to have_content('Michael Bluth')
+ expect(page).not_to have_content('@michael_bluth')
+
+ expect(page).not_to have_content('George Oscar Bluth')
+ expect(page).not_to have_content('@gob_2018')
+ end
+ end
+end