diff options
author | Alexis Reigel <alexis.reigel.ext@siemens.com> | 2018-08-15 13:53:23 +0200 |
---|---|---|
committer | Alexis Reigel <alexis.reigel.ext@siemens.com> | 2019-03-14 18:16:03 +0100 |
commit | 22f44b50d8ece6cdb2d83cb8e2b1c5b51f01d70d (patch) | |
tree | 8bde2d73db686a43f8e8a323ea59c3992ee10550 /spec/features/search | |
parent | 70261ff11c93dcad30b0f4b3b61c4289d0ae1bb3 (diff) | |
download | gitlab-ce-22f44b50d8ece6cdb2d83cb8e2b1c5b51f01d70d.tar.gz |
add users search results to project scoped search
Diffstat (limited to 'spec/features/search')
-rw-r--r-- | spec/features/search/user_searches_for_users_spec.rb | 53 |
1 files changed, 53 insertions, 0 deletions
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 |