diff options
21 files changed, 54 insertions, 54 deletions
diff --git a/spec/features/atom/issues_spec.rb b/spec/features/atom/issues_spec.rb index a61231ea254..c8ef4533b98 100644 --- a/spec/features/atom/issues_spec.rb +++ b/spec/features/atom/issues_spec.rb @@ -15,7 +15,7 @@ describe 'Issues Feed', feature: true do context 'when authenticated' do it 'renders atom feed' do - login_with user + gitlab_sign_in user visit namespace_project_issues_path(project.namespace, project, :atom) expect(response_headers['Content-Type']). diff --git a/spec/features/commits_spec.rb b/spec/features/commits_spec.rb index 191bc9c8b4e..ab2d85371bf 100644 --- a/spec/features/commits_spec.rb +++ b/spec/features/commits_spec.rb @@ -191,7 +191,7 @@ describe 'Commits' do before do project.team << [user, :master] - login_with(user) + gitlab_sign_in(user) visit namespace_project_commits_path(project.namespace, project, branch_name) end diff --git a/spec/features/dashboard_milestones_spec.rb b/spec/features/dashboard_milestones_spec.rb index f32fddbc9fa..b308a2297b9 100644 --- a/spec/features/dashboard_milestones_spec.rb +++ b/spec/features/dashboard_milestones_spec.rb @@ -17,7 +17,7 @@ feature 'Dashboard > Milestones', feature: true do let!(:milestone) { create(:milestone, project: project) } before do project.team << [user, :master] - login_with(user) + gitlab_sign_in(user) visit dashboard_milestones_path end diff --git a/spec/features/global_search_spec.rb b/spec/features/global_search_spec.rb index 4b22b07494d..54ebfe6cf77 100644 --- a/spec/features/global_search_spec.rb +++ b/spec/features/global_search_spec.rb @@ -6,7 +6,7 @@ feature 'Global search', feature: true do before do project.team << [user, :master] - login_with(user) + gitlab_sign_in(user) end describe 'I search through the issues and I see pagination' do diff --git a/spec/features/issues/user_uses_slash_commands_spec.rb b/spec/features/issues/user_uses_slash_commands_spec.rb index 4398c2dce01..6ff4fbe9dc2 100644 --- a/spec/features/issues/user_uses_slash_commands_spec.rb +++ b/spec/features/issues/user_uses_slash_commands_spec.rb @@ -13,7 +13,7 @@ feature 'Issues > User uses quick actions', feature: true, js: true do before do project.team << [user, :master] - login_with(user) + gitlab_sign_in(user) visit namespace_project_issue_path(project.namespace, project, issue) end @@ -42,7 +42,7 @@ feature 'Issues > User uses quick actions', feature: true, js: true do before do project.team << [guest, :guest] logout - login_with(guest) + gitlab_sign_in(guest) visit namespace_project_issue_path(project.namespace, project, issue) end @@ -82,7 +82,7 @@ feature 'Issues > User uses quick actions', feature: true, js: true do before do project.team << [guest, :guest] logout - login_with(guest) + gitlab_sign_in(guest) visit namespace_project_issue_path(project.namespace, project, issue) end diff --git a/spec/features/issues_spec.rb b/spec/features/issues_spec.rb index df42009ec24..aa7a9c50d16 100644 --- a/spec/features/issues_spec.rb +++ b/spec/features/issues_spec.rb @@ -484,7 +484,7 @@ describe 'Issues', feature: true do it 'shows assignee text', js: true do logout - login_with guest + gitlab_sign_in guest visit namespace_project_issue_path(project.namespace, project, issue) expect(page).to have_content issue.assignees.first.name @@ -547,7 +547,7 @@ describe 'Issues', feature: true do it 'shows milestone text', js: true do logout - login_with guest + gitlab_sign_in guest visit namespace_project_issue_path(project.namespace, project, issue) expect(page).to have_content milestone.title diff --git a/spec/features/login_spec.rb b/spec/features/login_spec.rb index 4763f454810..b43e6a06a07 100644 --- a/spec/features/login_spec.rb +++ b/spec/features/login_spec.rb @@ -36,7 +36,7 @@ feature 'Login', feature: true do it 'prevents the user from logging in' do user = create(:user, :blocked) - login_with(user) + gitlab_sign_in(user) expect(page).to have_content('Your account has been blocked.') end @@ -44,19 +44,19 @@ feature 'Login', feature: true do it 'does not update Devise trackable attributes', :redis do user = create(:user, :blocked) - expect { login_with(user) }.not_to change { user.reload.sign_in_count } + expect { gitlab_sign_in(user) }.not_to change { user.reload.sign_in_count } end end describe 'with the ghost user' do it 'disallows login' do - login_with(User.ghost) + gitlab_sign_in(User.ghost) expect(page).to have_content('Invalid Login or password.') end it 'does not update Devise trackable attributes', :redis do - expect { login_with(User.ghost) }.not_to change { User.ghost.reload.sign_in_count } + expect { gitlab_sign_in(User.ghost) }.not_to change { User.ghost.reload.sign_in_count } end end @@ -70,7 +70,7 @@ feature 'Login', feature: true do let(:user) { create(:user, :two_factor) } before do - login_with(user, remember: true) + gitlab_sign_in(user, remember: true) expect(page).to have_content('Two-Factor Authentication') end @@ -167,7 +167,7 @@ feature 'Login', feature: true do it 'shows 2FA prompt after OAuth login' do stub_omniauth_config(enabled: true, auto_link_saml_user: true, allow_single_sign_on: ['saml'], providers: [saml_config]) user = create(:omniauth_user, :two_factor, extern_uid: 'my-uid', provider: 'saml') - login_via('saml', user, 'my-uid') + gitlab_sign_in_via('saml', user, 'my-uid') expect(page).to have_content('Two-Factor Authentication') enter_code(user.current_otp) @@ -180,19 +180,19 @@ feature 'Login', feature: true do let(:user) { create(:user) } it 'allows basic login' do - login_with(user) + gitlab_sign_in(user) expect(current_path).to eq root_path end it 'does not show a "You are already signed in." error message' do - login_with(user) + gitlab_sign_in(user) expect(page).not_to have_content('You are already signed in.') end it 'blocks invalid login' do user = create(:user, password: 'not-the-default') - login_with(user) + gitlab_sign_in(user) expect(page).to have_content('Invalid Login or password.') end end @@ -209,7 +209,7 @@ feature 'Login', feature: true do context 'with grace period defined' do before do stub_application_setting(two_factor_grace_period: 48) - login_with(user) + gitlab_sign_in(user) end context 'within the grace period' do @@ -246,7 +246,7 @@ feature 'Login', feature: true do context 'without grace period defined' do before do stub_application_setting(two_factor_grace_period: 0) - login_with(user) + gitlab_sign_in(user) end it 'redirects to two-factor configuration page' do @@ -269,7 +269,7 @@ feature 'Login', feature: true do context 'with grace period defined' do before do stub_application_setting(two_factor_grace_period: 48) - login_with(user) + gitlab_sign_in(user) end context 'within the grace period' do @@ -310,7 +310,7 @@ feature 'Login', feature: true do context 'without grace period defined' do before do stub_application_setting(two_factor_grace_period: 0) - login_with(user) + gitlab_sign_in(user) end it 'redirects to two-factor configuration page' do diff --git a/spec/features/merge_requests/user_uses_slash_commands_spec.rb b/spec/features/merge_requests/user_uses_slash_commands_spec.rb index 82c7a750248..9ef9f8c0410 100644 --- a/spec/features/merge_requests/user_uses_slash_commands_spec.rb +++ b/spec/features/merge_requests/user_uses_slash_commands_spec.rb @@ -16,7 +16,7 @@ feature 'Merge Requests > User uses quick actions', feature: true, js: true do describe 'merge-request-only commands' do before do project.team << [user, :master] - login_with(user) + gitlab_sign_in(user) visit namespace_project_merge_request_path(project.namespace, project, merge_request) end @@ -52,7 +52,7 @@ feature 'Merge Requests > User uses quick actions', feature: true, js: true do before do project.team << [guest, :guest] logout - login_with(guest) + gitlab_sign_in(guest) visit namespace_project_merge_request_path(project.namespace, project, merge_request) end @@ -98,7 +98,7 @@ feature 'Merge Requests > User uses quick actions', feature: true, js: true do before do project.team << [guest, :guest] logout - login_with(guest) + gitlab_sign_in(guest) visit namespace_project_merge_request_path(project.namespace, project, merge_request) end @@ -127,7 +127,7 @@ feature 'Merge Requests > User uses quick actions', feature: true, js: true do before do logout another_project.team << [user, :master] - login_with(user) + gitlab_sign_in(user) end it 'changes target_branch in new merge_request' do @@ -182,7 +182,7 @@ feature 'Merge Requests > User uses quick actions', feature: true, js: true do before do project.team << [guest, :guest] logout - login_with(guest) + gitlab_sign_in(guest) visit namespace_project_merge_request_path(project.namespace, project, merge_request) end diff --git a/spec/features/projects/files/browse_files_spec.rb b/spec/features/projects/files/browse_files_spec.rb index 30a1eedbb48..2a82c3ac179 100644 --- a/spec/features/projects/files/browse_files_spec.rb +++ b/spec/features/projects/files/browse_files_spec.rb @@ -6,7 +6,7 @@ feature 'user browses project', feature: true, js: true do before do project.team << [user, :master] - login_with(user) + gitlab_sign_in(user) visit namespace_project_tree_path(project.namespace, project, project.default_branch) end diff --git a/spec/features/projects/jobs_spec.rb b/spec/features/projects/jobs_spec.rb index 800a29cf55b..6913bd20573 100644 --- a/spec/features/projects/jobs_spec.rb +++ b/spec/features/projects/jobs_spec.rb @@ -393,7 +393,7 @@ feature 'Jobs', :feature do project.update(visibility_level: Gitlab::VisibilityLevel::PUBLIC) logout_direct - login_with(create(:user)) + gitlab_sign_in(create(:user)) visit namespace_project_job_path(project.namespace, project, job) end diff --git a/spec/features/projects_spec.rb b/spec/features/projects_spec.rb index 67c8b8a5ba0..7e8a703db93 100644 --- a/spec/features/projects_spec.rb +++ b/spec/features/projects_spec.rb @@ -39,7 +39,7 @@ feature 'Project', feature: true do let(:project) { create(:empty_project, namespace: user.namespace) } before do - login_with user + gitlab_sign_in user create(:forked_project_link, forked_to_project: project) visit edit_namespace_project_path(project.namespace, project) end @@ -60,7 +60,7 @@ feature 'Project', feature: true do let(:project) { create(:empty_project, namespace: user.namespace, name: 'project1') } before do - login_with(user) + gitlab_sign_in(user) project.team << [user, :master] visit edit_namespace_project_path(project.namespace, project) end @@ -79,7 +79,7 @@ feature 'Project', feature: true do let(:project) { create(:empty_project, namespace: user.namespace) } before do - login_with(user) + gitlab_sign_in(user) project.add_user(user, Gitlab::Access::MASTER) visit namespace_project_path(project.namespace, project) end @@ -98,7 +98,7 @@ feature 'Project', feature: true do context 'on issues page', js: true do before do - login_with(user) + gitlab_sign_in(user) project.add_user(user, Gitlab::Access::MASTER) project2.add_user(user, Gitlab::Access::MASTER) visit namespace_project_issue_path(project.namespace, project, issue) diff --git a/spec/features/search_spec.rb b/spec/features/search_spec.rb index 89d4f536b20..64469f999af 100644 --- a/spec/features/search_spec.rb +++ b/spec/features/search_spec.rb @@ -9,7 +9,7 @@ describe "Search", feature: true do let!(:issue2) { create(:issue, project: project, author: user) } before do - login_with(user) + gitlab_sign_in(user) project.team << [user, :reporter] visit search_path end diff --git a/spec/features/tags/master_creates_tag_spec.rb b/spec/features/tags/master_creates_tag_spec.rb index 9030a2f2ff5..52db3583dac 100644 --- a/spec/features/tags/master_creates_tag_spec.rb +++ b/spec/features/tags/master_creates_tag_spec.rb @@ -6,7 +6,7 @@ feature 'Master creates tag', feature: true do before do project.team << [user, :master] - login_with(user) + gitlab_sign_in(user) end context 'from tag list' do diff --git a/spec/features/tags/master_deletes_tag_spec.rb b/spec/features/tags/master_deletes_tag_spec.rb index ccfafe6db7d..58f33e954f9 100644 --- a/spec/features/tags/master_deletes_tag_spec.rb +++ b/spec/features/tags/master_deletes_tag_spec.rb @@ -6,7 +6,7 @@ feature 'Master deletes tag', feature: true do before do project.team << [user, :master] - login_with(user) + gitlab_sign_in(user) visit namespace_project_tags_path(project.namespace, project) end diff --git a/spec/features/tags/master_updates_tag_spec.rb b/spec/features/tags/master_updates_tag_spec.rb index 3582f41938a..18c8c4c511c 100644 --- a/spec/features/tags/master_updates_tag_spec.rb +++ b/spec/features/tags/master_updates_tag_spec.rb @@ -6,7 +6,7 @@ feature 'Master updates tag', feature: true do before do project.team << [user, :master] - login_with(user) + gitlab_sign_in(user) visit namespace_project_tags_path(project.namespace, project) end diff --git a/spec/features/tags/master_views_tags_spec.rb b/spec/features/tags/master_views_tags_spec.rb index 922ac15a2eb..3c21fa06694 100644 --- a/spec/features/tags/master_views_tags_spec.rb +++ b/spec/features/tags/master_views_tags_spec.rb @@ -5,7 +5,7 @@ feature 'Master views tags', feature: true do before do project.team << [user, :master] - login_with(user) + gitlab_sign_in(user) end context 'when project has no tags' do diff --git a/spec/features/task_lists_spec.rb b/spec/features/task_lists_spec.rb index 85b1d0b153b..51b1b8e2328 100644 --- a/spec/features/task_lists_spec.rb +++ b/spec/features/task_lists_spec.rb @@ -55,7 +55,7 @@ feature 'Task Lists', feature: true do project.team << [user, :master] project.team << [user2, :guest] - gitlab_sign_in(user) + login_as(user) end def visit_issue(project, issue) @@ -90,7 +90,7 @@ feature 'Task Lists', feature: true do expect(page).to have_selector(".wiki .task-list .task-list-item .task-list-item-checkbox") logout(:user) - gitlab_sign_in(user2) + login_as(user2) visit current_path wait_for_requests @@ -203,7 +203,7 @@ feature 'Task Lists', feature: true do logout(:user) - gitlab_sign_in(user2) + login_as(user2) visit current_path expect(page).not_to have_selector('.js-task-list-container') end @@ -275,7 +275,7 @@ feature 'Task Lists', feature: true do logout(:user) - gitlab_sign_in(user2) + login_as(user2) visit current_path expect(page).not_to have_selector('.js-task-list-container') end diff --git a/spec/features/u2f_spec.rb b/spec/features/u2f_spec.rb index 02696841628..c2b957b2962 100644 --- a/spec/features/u2f_spec.rb +++ b/spec/features/u2f_spec.rb @@ -158,7 +158,7 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', :js do describe "when 2FA via OTP is disabled" do it "allows logging in with the U2F device" do user.update_attribute(:otp_required_for_login, false) - login_with(user) + gitlab_sign_in(user) @u2f_device.respond_to_u2f_authentication @@ -170,7 +170,7 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', :js do describe "when 2FA via OTP is enabled" do it "allows logging in with the U2F device" do user.update_attribute(:otp_required_for_login, true) - login_with(user) + gitlab_sign_in(user) @u2f_device.respond_to_u2f_authentication @@ -180,7 +180,7 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', :js do end it 'persists remember_me value via hidden field' do - login_with(user, remember: true) + gitlab_sign_in(user, remember: true) @u2f_device.respond_to_u2f_authentication expect(page).to have_content('We heard back from your U2F device') @@ -308,7 +308,7 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', :js do describe 'when no u2f device is registered' do before do logout - login_with(user) + gitlab_sign_in(user) end it 'shows the fallback otp code UI' do @@ -321,7 +321,7 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', :js do manage_two_factor_authentication @u2f_device = register_u2f_device logout - login_with(user) + gitlab_sign_in(user) end it 'provides a button that shows the fallback otp code UI' do diff --git a/spec/features/users_spec.rb b/spec/features/users_spec.rb index c241dae12cf..84af13d3e49 100644 --- a/spec/features/users_spec.rb +++ b/spec/features/users_spec.rb @@ -24,7 +24,7 @@ feature 'Users', feature: true, js: true do user.reload expect(user.reset_password_token).not_to be_nil - login_with(user) + gitlab_sign_in(user) expect(current_path).to eq root_path user.reload diff --git a/spec/support/features/issuable_slash_commands_shared_examples.rb b/spec/support/features/issuable_slash_commands_shared_examples.rb index db39e8dfd89..023bdfc833f 100644 --- a/spec/support/features/issuable_slash_commands_shared_examples.rb +++ b/spec/support/features/issuable_slash_commands_shared_examples.rb @@ -17,7 +17,7 @@ shared_examples 'issuable record that supports quick actions in its description project.team << [master, :master] project.team << [assignee, :developer] project.team << [guest, :guest] - login_with(master) + gitlab_sign_in(master) end after do @@ -106,7 +106,7 @@ shared_examples 'issuable record that supports quick actions in its description context "when current user cannot close #{issuable_type}" do before do logout - login_with(guest) + gitlab_sign_in(guest) visit public_send("namespace_project_#{issuable_type}_path", project.namespace, project, issuable) end @@ -141,7 +141,7 @@ shared_examples 'issuable record that supports quick actions in its description context "when current user cannot reopen #{issuable_type}" do before do logout - login_with(guest) + gitlab_sign_in(guest) visit public_send("namespace_project_#{issuable_type}_path", project.namespace, project, issuable) end @@ -171,7 +171,7 @@ shared_examples 'issuable record that supports quick actions in its description context "when current user cannot change title of #{issuable_type}" do before do logout - login_with(guest) + gitlab_sign_in(guest) visit public_send("namespace_project_#{issuable_type}_path", project.namespace, project, issuable) end diff --git a/spec/support/login_helpers.rb b/spec/support/login_helpers.rb index cd6af454f48..879386b5437 100644 --- a/spec/support/login_helpers.rb +++ b/spec/support/login_helpers.rb @@ -14,7 +14,7 @@ module LoginHelpers # # Provide an existing User record # user = create(:user) # gitlab_sign_in(user) - def gitlab_sign_in(user_or_role) + def gitlab_sign_in(user_or_role, **kwargs) @user = if user_or_role.is_a?(User) user_or_role @@ -22,7 +22,7 @@ module LoginHelpers create(user_or_role) end - gitlab_sign_in_with(@user) + gitlab_sign_in_with(@user, **kwargs) end def gitlab_sign_in_via(provider, user, uid) |