diff options
author | Winnie Hellmann <winnie@gitlab.com> | 2018-07-05 09:32:05 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2018-07-05 09:32:05 +0300 |
commit | 3db2f327594e134729a0ca2f48a748bb28ab7d6c (patch) | |
tree | 661033b988897aaf506c0deaf457c2002e17d51b /spec/features/projects/members | |
parent | baab4cddb091c0aa9649fecc340b8b343747ba83 (diff) |
Enable Capybara/FeatureMethods cop
Diffstat (limited to 'spec/features/projects/members')
16 files changed, 81 insertions, 81 deletions
diff --git a/spec/features/projects/members/anonymous_user_sees_members_spec.rb b/spec/features/projects/members/anonymous_user_sees_members_spec.rb index e2a48bfd1d4..19e52294a38 100644 --- a/spec/features/projects/members/anonymous_user_sees_members_spec.rb +++ b/spec/features/projects/members/anonymous_user_sees_members_spec.rb @@ -1,16 +1,16 @@ require 'spec_helper' -feature 'Projects > Members > Anonymous user sees members' do +describe 'Projects > Members > Anonymous user sees members' do let(:user) { create(:user) } let(:group) { create(:group, :public) } let(:project) { create(:project, :public) } - background do + before do project.add_master(user) create(:project_group_link, project: project, group: group) end - scenario "anonymous user visits the project's members page and sees the list of members" do + it "anonymous user visits the project's members page and sees the list of members" do visit project_project_members_path(project) expect(current_path).to eq( diff --git a/spec/features/projects/members/group_member_cannot_leave_group_project_spec.rb b/spec/features/projects/members/group_member_cannot_leave_group_project_spec.rb index 6b450fa4e45..0ab29660189 100644 --- a/spec/features/projects/members/group_member_cannot_leave_group_project_spec.rb +++ b/spec/features/projects/members/group_member_cannot_leave_group_project_spec.rb @@ -1,17 +1,17 @@ require 'spec_helper' -feature 'Projects > Members > Group member cannot leave group project' do +describe 'Projects > Members > Group member cannot leave group project' do let(:user) { create(:user) } let(:group) { create(:group) } let(:project) { create(:project, namespace: group) } - background do + before do group.add_developer(user) sign_in(user) visit project_path(project) end - scenario 'user does not see a "Leave project" link' do + it 'user does not see a "Leave project" link' do expect(page).not_to have_content 'Leave project' end end diff --git a/spec/features/projects/members/group_member_cannot_request_access_to_his_group_project_spec.rb b/spec/features/projects/members/group_member_cannot_request_access_to_his_group_project_spec.rb index 296a80a3c60..7bc53345ddf 100644 --- a/spec/features/projects/members/group_member_cannot_request_access_to_his_group_project_spec.rb +++ b/spec/features/projects/members/group_member_cannot_request_access_to_his_group_project_spec.rb @@ -1,39 +1,39 @@ require 'spec_helper' -feature 'Projects > Members > Group member cannot request access to his group project' do +describe 'Projects > Members > Group member cannot request access to his group project' do let(:user) { create(:user) } let(:group) { create(:group) } let(:project) { create(:project, namespace: group) } - scenario 'owner does not see the request access button' do + it 'owner does not see the request access button' do group.add_owner(user) login_and_visit_project_page(user) expect(page).not_to have_content 'Request Access' end - scenario 'master does not see the request access button' do + it 'master does not see the request access button' do group.add_master(user) login_and_visit_project_page(user) expect(page).not_to have_content 'Request Access' end - scenario 'developer does not see the request access button' do + it 'developer does not see the request access button' do group.add_developer(user) login_and_visit_project_page(user) expect(page).not_to have_content 'Request Access' end - scenario 'reporter does not see the request access button' do + it 'reporter does not see the request access button' do group.add_reporter(user) login_and_visit_project_page(user) expect(page).not_to have_content 'Request Access' end - scenario 'guest does not see the request access button' do + it 'guest does not see the request access button' do group.add_guest(user) login_and_visit_project_page(user) diff --git a/spec/features/projects/members/group_members_spec.rb b/spec/features/projects/members/group_members_spec.rb index e22b6fa6c43..41b2beb40b9 100644 --- a/spec/features/projects/members/group_members_spec.rb +++ b/spec/features/projects/members/group_members_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Projects members' do +describe 'Projects members' do let(:user) { create(:user) } let(:developer) { create(:user) } let(:group) { create(:group, :public, :access_requestable) } @@ -10,7 +10,7 @@ feature 'Projects members' do let(:project_requester) { create(:user) } let(:group_requester) { create(:user) } - background do + before do project.add_developer(developer) group.add_owner(user) sign_in(user) @@ -22,7 +22,7 @@ feature 'Projects members' do visit project_settings_members_path(project) end - scenario 'does not appear in the project members page' do + it 'does not appear in the project members page' do page.within first('.content-list') do expect(page).not_to have_content('test2@abc.com') end @@ -36,7 +36,7 @@ feature 'Projects members' do visit project_settings_members_path(project) end - scenario 'shows the project invitee, the project developer, and the group owner' do + it 'shows the project invitee, the project developer, and the group owner' do page.within first('.content-list') do expect(page).to have_content('test1@abc.com') expect(page).not_to have_content('test2@abc.com') @@ -57,7 +57,7 @@ feature 'Projects members' do visit project_settings_members_path(project) end - scenario 'does not appear in the project members page' do + it 'does not appear in the project members page' do page.within first('.content-list') do expect(page).not_to have_content(group_requester.name) end @@ -71,7 +71,7 @@ feature 'Projects members' do visit project_settings_members_path(project) end - scenario 'shows the project requester, the project developer, and the group owner' do + it 'shows the project requester, the project developer, and the group owner' do page.within first('.content-list') do expect(page).to have_content(project_requester.name) expect(page).not_to have_content(group_requester.name) diff --git a/spec/features/projects/members/group_requester_cannot_request_access_to_project_spec.rb b/spec/features/projects/members/group_requester_cannot_request_access_to_project_spec.rb index 6d729f2f85f..ea3894c92bd 100644 --- a/spec/features/projects/members/group_requester_cannot_request_access_to_project_spec.rb +++ b/spec/features/projects/members/group_requester_cannot_request_access_to_project_spec.rb @@ -1,12 +1,12 @@ require 'spec_helper' -feature 'Projects > Members > Group requester cannot request access to project', :js do +describe 'Projects > Members > Group requester cannot request access to project', :js do let(:user) { create(:user) } let(:owner) { create(:user) } let(:group) { create(:group, :public, :access_requestable) } let(:project) { create(:project, :public, :access_requestable, namespace: group) } - background do + before do group.add_owner(owner) sign_in(user) visit group_path(group) @@ -14,7 +14,7 @@ feature 'Projects > Members > Group requester cannot request access to project', visit project_path(project) end - scenario 'group requester does not see the request access / withdraw access request button' do + it 'group requester does not see the request access / withdraw access request button' do expect(page).not_to have_content 'Request Access' expect(page).not_to have_content 'Withdraw Access Request' end diff --git a/spec/features/projects/members/groups_with_access_list_spec.rb b/spec/features/projects/members/groups_with_access_list_spec.rb index e6d0c6e00f8..b65c46b345f 100644 --- a/spec/features/projects/members/groups_with_access_list_spec.rb +++ b/spec/features/projects/members/groups_with_access_list_spec.rb @@ -1,11 +1,11 @@ require 'spec_helper' -feature 'Projects > Members > Groups with access list', :js do +describe 'Projects > Members > Groups with access list', :js do let(:user) { create(:user) } let(:group) { create(:group, :public) } let(:project) { create(:project, :public) } - background do + before do project.add_master(user) @group_link = create(:project_group_link, project: project, group: group) @@ -13,7 +13,7 @@ feature 'Projects > Members > Groups with access list', :js do visit project_settings_members_path(project) end - scenario 'updates group access level' do + it 'updates group access level' do click_button @group_link.human_access page.within '.dropdown-menu' do @@ -27,7 +27,7 @@ feature 'Projects > Members > Groups with access list', :js do expect(first('.group_member')).to have_content('Guest') end - scenario 'updates expiry date' do + it 'updates expiry date' do tomorrow = Date.today + 3 fill_in "member_expires_at_#{group.id}", with: tomorrow.strftime("%F") @@ -39,7 +39,7 @@ feature 'Projects > Members > Groups with access list', :js do end end - scenario 'deletes group link' do + it 'deletes group link' do page.within(first('.group_member')) do accept_confirm { find('.btn-remove').click } end @@ -49,7 +49,7 @@ feature 'Projects > Members > Groups with access list', :js do end context 'search in existing members (yes, this filters the groups list as well)' do - scenario 'finds no results' do + it 'finds no results' do page.within '.member-search-form' do fill_in 'search', with: 'testing 123' find('.member-search-btn').click @@ -58,7 +58,7 @@ feature 'Projects > Members > Groups with access list', :js do expect(page).not_to have_selector('.group_member') end - scenario 'finds results' do + it 'finds results' do page.within '.member-search-form' do fill_in 'search', with: group.name find('.member-search-btn').click diff --git a/spec/features/projects/members/list_spec.rb b/spec/features/projects/members/list_spec.rb index 65b11a1d9e7..c2e980e75b8 100644 --- a/spec/features/projects/members/list_spec.rb +++ b/spec/features/projects/members/list_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Project members list' do +describe 'Project members list' do include Select2Helper let(:user1) { create(:user, name: 'John Doe') } @@ -8,12 +8,12 @@ feature 'Project members list' do let(:group) { create(:group) } let(:project) { create(:project, namespace: group) } - background do + before do sign_in(user1) group.add_owner(user1) end - scenario 'show members from project and group' do + it 'show members from project and group' do project.add_developer(user2) visit_members_page @@ -22,7 +22,7 @@ feature 'Project members list' do expect(second_row.text).to include(user2.name) end - scenario 'show user once if member of both group and project' do + it 'show user once if member of both group and project' do project.add_developer(user1) visit_members_page @@ -31,7 +31,7 @@ feature 'Project members list' do expect(second_row).to be_blank end - scenario 'update user acess level', :js do + it 'update user acess level', :js do project.add_developer(user2) visit_members_page @@ -44,7 +44,7 @@ feature 'Project members list' do end end - scenario 'add user to project', :js do + it 'add user to project', :js do visit_members_page add_user(user2.id, 'Reporter') @@ -55,7 +55,7 @@ feature 'Project members list' do end end - scenario 'remove user from project', :js do + it 'remove user from project', :js do other_user = create(:user) project.add_developer(other_user) @@ -71,7 +71,7 @@ feature 'Project members list' do expect(project.users).not_to include(other_user) end - scenario 'invite user to project', :js do + it 'invite user to project', :js do visit_members_page add_user('test@example.com', 'Reporter') diff --git a/spec/features/projects/members/master_adds_member_with_expiration_date_spec.rb b/spec/features/projects/members/master_adds_member_with_expiration_date_spec.rb index 8fe340d3bae..90f09bf6264 100644 --- a/spec/features/projects/members/master_adds_member_with_expiration_date_spec.rb +++ b/spec/features/projects/members/master_adds_member_with_expiration_date_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Projects > Members > Master adds member with expiration date', :js do +describe 'Projects > Members > Master adds member with expiration date', :js do include Select2Helper include ActiveSupport::Testing::TimeHelpers @@ -8,12 +8,12 @@ feature 'Projects > Members > Master adds member with expiration date', :js do let(:project) { create(:project) } let!(:new_member) { create(:user) } - background do + before do project.add_master(master) sign_in(master) end - scenario 'expiration date is displayed in the members list' do + it 'expiration date is displayed in the members list' do travel_to Time.zone.parse('2016-08-06 08:00') do date = 4.days.from_now visit project_project_members_path(project) @@ -30,7 +30,7 @@ feature 'Projects > Members > Master adds member with expiration date', :js do end end - scenario 'change expiration date' do + it 'change expiration date' do travel_to Time.zone.parse('2016-08-06 08:00') do date = 3.days.from_now project.team.add_users([new_member.id], :developer, expires_at: Date.today.to_s(:medium)) diff --git a/spec/features/projects/members/master_manages_access_requests_spec.rb b/spec/features/projects/members/master_manages_access_requests_spec.rb index 3ac6ca4fc86..112b06c047d 100644 --- a/spec/features/projects/members/master_manages_access_requests_spec.rb +++ b/spec/features/projects/members/master_manages_access_requests_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Projects > Members > Master manages access requests' do +describe 'Projects > Members > Master manages access requests' do it_behaves_like 'Master manages access requests' do let(:entity) { create(:project, :public, :access_requestable) } let(:members_page_path) { project_project_members_path(entity) } diff --git a/spec/features/projects/members/member_cannot_request_access_to_his_project_spec.rb b/spec/features/projects/members/member_cannot_request_access_to_his_project_spec.rb index 47911c32a72..f612ad8d551 100644 --- a/spec/features/projects/members/member_cannot_request_access_to_his_project_spec.rb +++ b/spec/features/projects/members/member_cannot_request_access_to_his_project_spec.rb @@ -1,16 +1,16 @@ require 'spec_helper' -feature 'Projects > Members > Member cannot request access to his project' do +describe 'Projects > Members > Member cannot request access to his project' do let(:member) { create(:user) } let(:project) { create(:project) } - background do + before do project.add_developer(member) sign_in(member) visit project_path(project) end - scenario 'member does not see the request access button' do + it 'member does not see the request access button' do expect(page).not_to have_content 'Request Access' end end diff --git a/spec/features/projects/members/member_leaves_project_spec.rb b/spec/features/projects/members/member_leaves_project_spec.rb index e54c2c76975..94b29de4686 100644 --- a/spec/features/projects/members/member_leaves_project_spec.rb +++ b/spec/features/projects/members/member_leaves_project_spec.rb @@ -1,16 +1,16 @@ require 'spec_helper' -feature 'Projects > Members > Member leaves project' do +describe 'Projects > Members > Member leaves project' do let(:user) { create(:user) } let(:project) { create(:project, :repository) } - background do + before do project.add_developer(user) sign_in(user) visit project_path(project) end - scenario 'user leaves project' do + it 'user leaves project' do click_link 'Leave project' expect(current_path).to eq(dashboard_projects_path) diff --git a/spec/features/projects/members/owner_cannot_leave_project_spec.rb b/spec/features/projects/members/owner_cannot_leave_project_spec.rb index 15162d01c44..0aa005adb4d 100644 --- a/spec/features/projects/members/owner_cannot_leave_project_spec.rb +++ b/spec/features/projects/members/owner_cannot_leave_project_spec.rb @@ -1,14 +1,14 @@ require 'spec_helper' -feature 'Projects > Members > Owner cannot leave project' do +describe 'Projects > Members > Owner cannot leave project' do let(:project) { create(:project) } - background do + before do sign_in(project.owner) visit project_path(project) end - scenario 'user does not see a "Leave project" link' do + it 'user does not see a "Leave project" link' do expect(page).not_to have_content 'Leave project' end end diff --git a/spec/features/projects/members/owner_cannot_request_access_to_his_project_spec.rb b/spec/features/projects/members/owner_cannot_request_access_to_his_project_spec.rb index c27925c8dc4..eb1b720af05 100644 --- a/spec/features/projects/members/owner_cannot_request_access_to_his_project_spec.rb +++ b/spec/features/projects/members/owner_cannot_request_access_to_his_project_spec.rb @@ -1,14 +1,14 @@ require 'spec_helper' -feature 'Projects > Members > Owner cannot request access to his project' do +describe 'Projects > Members > Owner cannot request access to his project' do let(:project) { create(:project) } - background do + before do sign_in(project.owner) visit project_path(project) end - scenario 'owner does not see the request access button' do + it 'owner does not see the request access button' do expect(page).not_to have_content 'Request Access' end end diff --git a/spec/features/projects/members/share_with_group_spec.rb b/spec/features/projects/members/share_with_group_spec.rb index 134c8b8bc39..b126f0c6cb1 100644 --- a/spec/features/projects/members/share_with_group_spec.rb +++ b/spec/features/projects/members/share_with_group_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Project > Members > Share with Group', :js do +describe 'Project > Members > Share with Group', :js do include Select2Helper include ActionView::Helpers::DateHelper @@ -8,14 +8,14 @@ feature 'Project > Members > Share with Group', :js do describe 'Share with group lock' do shared_examples 'the project can be shared with groups' do - scenario 'the "Share with group" tab exists' do + it 'the "Share with group" tab exists' do visit project_settings_members_path(project) expect(page).to have_selector('#share-with-group-tab') end end shared_examples 'the project cannot be shared with groups' do - scenario 'the "Share with group" tab does not exist' do + it 'the "Share with group" tab does not exist' do visit project_settings_members_path(project) expect(page).to have_selector('#add-member-tab') expect(page).not_to have_selector('#share-with-group-tab') @@ -26,7 +26,7 @@ feature 'Project > Members > Share with Group', :js do let!(:group_to_share_with) { create(:group) } let(:project) { create(:project, namespace: create(:group)) } - background do + before do project.add_master(master) sign_in(master) end @@ -34,7 +34,7 @@ feature 'Project > Members > Share with Group', :js do context 'when the group has "Share with group lock" disabled' do it_behaves_like 'the project can be shared with groups' - scenario 'the project can be shared with another group' do + it 'the project can be shared with another group' do visit project_settings_members_path(project) click_on 'share-with-group-tab' @@ -64,7 +64,7 @@ feature 'Project > Members > Share with Group', :js do let(:subgroup) { create(:group, parent: root_group) } let(:project) { create(:project, namespace: subgroup) } - background do + before do project.add_master(master) sign_in(master) end @@ -126,7 +126,7 @@ feature 'Project > Members > Share with Group', :js do find('.btn-create').click end - scenario 'the group link shows the expiration time with a warning class' do + it 'the group link shows the expiration time with a warning class' do page.within('.project-members-groups') do # Using distance_of_time_in_words_to_now because it is not the same as # subtraction, and this way avoids time zone issues as well @@ -141,7 +141,7 @@ feature 'Project > Members > Share with Group', :js do context 'with multiple groups to choose from' do let(:project) { create(:project) } - background do + before do project.add_master(master) sign_in(master) @@ -173,14 +173,14 @@ feature 'Project > Members > Share with Group', :js do let!(:group_to_share_with) { create(:group) } let!(:project) { create(:project, namespace: nested_group) } - background do + before do project.add_master(master) sign_in(master) group.add_master(master) group_to_share_with.add_master(master) end - scenario 'the groups dropdown does not show ancestors', :nested_groups do + it 'the groups dropdown does not show ancestors', :nested_groups do visit project_settings_members_path(project) click_on 'share-with-group-tab' diff --git a/spec/features/projects/members/sorting_spec.rb b/spec/features/projects/members/sorting_spec.rb index afa173c59e5..1e1071348c3 100644 --- a/spec/features/projects/members/sorting_spec.rb +++ b/spec/features/projects/members/sorting_spec.rb @@ -1,17 +1,17 @@ require 'spec_helper' -feature 'Projects > Members > Sorting' do +describe 'Projects > Members > Sorting' do let(:master) { create(:user, name: 'John Doe') } let(:developer) { create(:user, name: 'Mary Jane', last_sign_in_at: 5.days.ago) } let(:project) { create(:project, namespace: master.namespace, creator: master) } - background do + before do create(:project_member, :developer, user: developer, project: project, created_at: 3.days.ago) sign_in(master) end - scenario 'sorts alphabetically by default' do + it 'sorts alphabetically by default' do visit_members_list(sort: nil) expect(first_member).to include(master.name) @@ -19,7 +19,7 @@ feature 'Projects > Members > Sorting' do expect(page).to have_css('.member-sort-dropdown .dropdown-toggle-text', text: 'Name, ascending') end - scenario 'sorts by access level ascending' do + it 'sorts by access level ascending' do visit_members_list(sort: :access_level_asc) expect(first_member).to include(developer.name) @@ -27,7 +27,7 @@ feature 'Projects > Members > Sorting' do expect(page).to have_css('.member-sort-dropdown .dropdown-toggle-text', text: 'Access level, ascending') end - scenario 'sorts by access level descending' do + it 'sorts by access level descending' do visit_members_list(sort: :access_level_desc) expect(first_member).to include(master.name) @@ -35,7 +35,7 @@ feature 'Projects > Members > Sorting' do expect(page).to have_css('.member-sort-dropdown .dropdown-toggle-text', text: 'Access level, descending') end - scenario 'sorts by last joined' do + it 'sorts by last joined' do visit_members_list(sort: :last_joined) expect(first_member).to include(master.name) @@ -43,7 +43,7 @@ feature 'Projects > Members > Sorting' do expect(page).to have_css('.member-sort-dropdown .dropdown-toggle-text', text: 'Last joined') end - scenario 'sorts by oldest joined' do + it 'sorts by oldest joined' do visit_members_list(sort: :oldest_joined) expect(first_member).to include(developer.name) @@ -51,7 +51,7 @@ feature 'Projects > Members > Sorting' do expect(page).to have_css('.member-sort-dropdown .dropdown-toggle-text', text: 'Oldest joined') end - scenario 'sorts by name ascending' do + it 'sorts by name ascending' do visit_members_list(sort: :name_asc) expect(first_member).to include(master.name) @@ -59,7 +59,7 @@ feature 'Projects > Members > Sorting' do expect(page).to have_css('.member-sort-dropdown .dropdown-toggle-text', text: 'Name, ascending') end - scenario 'sorts by name descending' do + it 'sorts by name descending' do visit_members_list(sort: :name_desc) expect(first_member).to include(developer.name) @@ -67,7 +67,7 @@ feature 'Projects > Members > Sorting' do expect(page).to have_css('.member-sort-dropdown .dropdown-toggle-text', text: 'Name, descending') end - scenario 'sorts by recent sign in', :clean_gitlab_redis_shared_state do + it 'sorts by recent sign in', :clean_gitlab_redis_shared_state do visit_members_list(sort: :recent_sign_in) expect(first_member).to include(master.name) @@ -75,7 +75,7 @@ feature 'Projects > Members > Sorting' do expect(page).to have_css('.member-sort-dropdown .dropdown-toggle-text', text: 'Recent sign in') end - scenario 'sorts by oldest sign in', :clean_gitlab_redis_shared_state do + it 'sorts by oldest sign in', :clean_gitlab_redis_shared_state do visit_members_list(sort: :oldest_sign_in) expect(first_member).to include(developer.name) diff --git a/spec/features/projects/members/user_requests_access_spec.rb b/spec/features/projects/members/user_requests_access_spec.rb index 672d5daa3d8..35d6ac1c650 100644 --- a/spec/features/projects/members/user_requests_access_spec.rb +++ b/spec/features/projects/members/user_requests_access_spec.rb @@ -1,23 +1,23 @@ require 'spec_helper' -feature 'Projects > Members > User requests access', :js do +describe 'Projects > Members > User requests access', :js do let(:user) { create(:user) } let(:project) { create(:project, :public, :access_requestable, :repository) } let(:master) { project.owner } - background do + before do sign_in(user) visit project_path(project) end - scenario 'request access feature is disabled' do + it 'request access feature is disabled' do project.update_attributes(request_access_enabled: false) visit project_path(project) expect(page).not_to have_content 'Request Access' end - scenario 'user can request access to a project' do + it 'user can request access to a project' do perform_enqueued_jobs { click_link 'Request Access' } expect(ActionMailer::Base.deliveries.last.to).to eq [master.notification_email] @@ -31,7 +31,7 @@ feature 'Projects > Members > User requests access', :js do end context 'code access is restricted' do - scenario 'user can request access' do + it 'user can request access' do project.project_feature.update!(repository_access_level: ProjectFeature::PRIVATE, builds_access_level: ProjectFeature::PRIVATE, merge_requests_access_level: ProjectFeature::PRIVATE) @@ -41,7 +41,7 @@ feature 'Projects > Members > User requests access', :js do end end - scenario 'user is not listed in the project members page' do + it 'user is not listed in the project members page' do click_link 'Request Access' expect(project.requesters.exists?(user_id: user)).to be_truthy @@ -55,7 +55,7 @@ feature 'Projects > Members > User requests access', :js do end end - scenario 'user can withdraw its request for access' do + it 'user can withdraw its request for access' do click_link 'Request Access' expect(project.requesters.exists?(user_id: user)).to be_truthy |