Commit 0f73a19d authored by Robert Speicher's avatar Robert Speicher

Change `login_with` uses to `gitlab_sign_in`

Change single `login_via` use to `gitlab_sign_in_via`
parent 2c733ac5
...@@ -15,7 +15,7 @@ describe 'Issues Feed', feature: true do ...@@ -15,7 +15,7 @@ describe 'Issues Feed', feature: true do
context 'when authenticated' do context 'when authenticated' do
it 'renders atom feed' do it 'renders atom feed' do
login_with user gitlab_sign_in user
visit namespace_project_issues_path(project.namespace, project, :atom) visit namespace_project_issues_path(project.namespace, project, :atom)
expect(response_headers['Content-Type']). expect(response_headers['Content-Type']).
......
...@@ -191,7 +191,7 @@ describe 'Commits' do ...@@ -191,7 +191,7 @@ describe 'Commits' do
before do before do
project.team << [user, :master] project.team << [user, :master]
login_with(user) gitlab_sign_in(user)
visit namespace_project_commits_path(project.namespace, project, branch_name) visit namespace_project_commits_path(project.namespace, project, branch_name)
end end
......
...@@ -17,7 +17,7 @@ feature 'Dashboard > Milestones', feature: true do ...@@ -17,7 +17,7 @@ feature 'Dashboard > Milestones', feature: true do
let!(:milestone) { create(:milestone, project: project) } let!(:milestone) { create(:milestone, project: project) }
before do before do
project.team << [user, :master] project.team << [user, :master]
login_with(user) gitlab_sign_in(user)
visit dashboard_milestones_path visit dashboard_milestones_path
end end
......
...@@ -9,7 +9,7 @@ feature 'Global elastic search', feature: true do ...@@ -9,7 +9,7 @@ feature 'Global elastic search', feature: true do
Gitlab::Elastic::Helper.create_empty_index Gitlab::Elastic::Helper.create_empty_index
project.team << [user, :master] project.team << [user, :master]
login_with(user) gitlab_sign_in(user)
end end
after do after do
......
...@@ -21,7 +21,7 @@ feature 'Group elastic search', js: true, feature: true do ...@@ -21,7 +21,7 @@ feature 'Group elastic search', js: true, feature: true do
project.team << [user, :master] project.team << [user, :master]
group.add_owner(user) group.add_owner(user)
login_with(user) gitlab_sign_in(user)
end end
after do after do
......
...@@ -6,7 +6,7 @@ feature 'Global search', feature: true do ...@@ -6,7 +6,7 @@ feature 'Global search', feature: true do
before do before do
project.team << [user, :master] project.team << [user, :master]
login_with(user) gitlab_sign_in(user)
end end
describe 'I search through the issues and I see pagination' do describe 'I search through the issues and I see pagination' do
......
...@@ -7,7 +7,7 @@ feature 'Groups > Contribution Analytics', js: true, feature: true do ...@@ -7,7 +7,7 @@ feature 'Groups > Contribution Analytics', js: true, feature: true do
before do before do
group.add_owner(user) group.add_owner(user)
login_with(user) gitlab_sign_in(user)
end end
describe 'visit Contribution Analytics page for group' do describe 'visit Contribution Analytics page for group' do
......
...@@ -8,7 +8,7 @@ feature 'Groups > Audit Events', js: true, feature: true do ...@@ -8,7 +8,7 @@ feature 'Groups > Audit Events', js: true, feature: true do
before do before do
group.add_owner(user) group.add_owner(user)
group.add_developer(pete) group.add_developer(pete)
login_with(user) gitlab_sign_in(user)
end end
describe 'changing a user access level' do describe 'changing a user access level' do
......
...@@ -7,7 +7,7 @@ feature 'Groups > Pipeline Quota', feature: true do ...@@ -7,7 +7,7 @@ feature 'Groups > Pipeline Quota', feature: true do
before do before do
group.add_owner(user) group.add_owner(user)
login_with(user) gitlab_sign_in(user)
end end
context 'with no quota' do context 'with no quota' do
......
...@@ -13,7 +13,7 @@ feature 'Issues > User uses quick actions', feature: true, js: true do ...@@ -13,7 +13,7 @@ feature 'Issues > User uses quick actions', feature: true, js: true do
before do before do
project.team << [user, :master] project.team << [user, :master]
login_with(user) gitlab_sign_in(user)
visit namespace_project_issue_path(project.namespace, project, issue) visit namespace_project_issue_path(project.namespace, project, issue)
end end
...@@ -42,7 +42,7 @@ feature 'Issues > User uses quick actions', feature: true, js: true do ...@@ -42,7 +42,7 @@ feature 'Issues > User uses quick actions', feature: true, js: true do
before do before do
project.team << [guest, :guest] project.team << [guest, :guest]
logout logout
login_with(guest) gitlab_sign_in(guest)
visit namespace_project_issue_path(project.namespace, project, issue) visit namespace_project_issue_path(project.namespace, project, issue)
end end
...@@ -82,7 +82,7 @@ feature 'Issues > User uses quick actions', feature: true, js: true do ...@@ -82,7 +82,7 @@ feature 'Issues > User uses quick actions', feature: true, js: true do
before do before do
project.team << [guest, :guest] project.team << [guest, :guest]
logout logout
login_with(guest) gitlab_sign_in(guest)
visit namespace_project_issue_path(project.namespace, project, issue) visit namespace_project_issue_path(project.namespace, project, issue)
end end
...@@ -182,7 +182,7 @@ feature 'Issues > User uses quick actions', feature: true, js: true do ...@@ -182,7 +182,7 @@ feature 'Issues > User uses quick actions', feature: true, js: true do
before do before do
project.team << [guest, :guest] project.team << [guest, :guest]
logout logout
login_with(guest) gitlab_sign_in(guest)
visit namespace_project_issue_path(project.namespace, project, issue) visit namespace_project_issue_path(project.namespace, project, issue)
end end
...@@ -220,7 +220,7 @@ feature 'Issues > User uses quick actions', feature: true, js: true do ...@@ -220,7 +220,7 @@ feature 'Issues > User uses quick actions', feature: true, js: true do
before do before do
project.team << [guest, :guest] project.team << [guest, :guest]
logout logout
login_with(guest) gitlab_sign_in(guest)
visit namespace_project_issue_path(project.namespace, project, issue) visit namespace_project_issue_path(project.namespace, project, issue)
end end
......
...@@ -499,7 +499,7 @@ describe 'Issues', feature: true do ...@@ -499,7 +499,7 @@ describe 'Issues', feature: true do
it 'shows assignee text', js: true do it 'shows assignee text', js: true do
logout logout
login_with guest gitlab_sign_in guest
visit namespace_project_issue_path(project.namespace, project, issue) visit namespace_project_issue_path(project.namespace, project, issue)
expect(page).to have_content issue.assignees.first.name expect(page).to have_content issue.assignees.first.name
...@@ -583,7 +583,7 @@ describe 'Issues', feature: true do ...@@ -583,7 +583,7 @@ describe 'Issues', feature: true do
it 'shows milestone text', js: true do it 'shows milestone text', js: true do
logout logout
login_with guest gitlab_sign_in guest
visit namespace_project_issue_path(project.namespace, project, issue) visit namespace_project_issue_path(project.namespace, project, issue)
expect(page).to have_content milestone.title expect(page).to have_content milestone.title
......
...@@ -36,7 +36,7 @@ feature 'Login', feature: true do ...@@ -36,7 +36,7 @@ feature 'Login', feature: true do
it 'prevents the user from logging in' do it 'prevents the user from logging in' do
user = create(:user, :blocked) user = create(:user, :blocked)
login_with(user) gitlab_sign_in(user)
expect(page).to have_content('Your account has been blocked.') expect(page).to have_content('Your account has been blocked.')
end end
...@@ -44,19 +44,19 @@ feature 'Login', feature: true do ...@@ -44,19 +44,19 @@ feature 'Login', feature: true do
it 'does not update Devise trackable attributes', :redis do it 'does not update Devise trackable attributes', :redis do
user = create(:user, :blocked) 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
end end
describe 'with the ghost user' do describe 'with the ghost user' do
it 'disallows login' do it 'disallows login' do
login_with(User.ghost) gitlab_sign_in(User.ghost)
expect(page).to have_content('Invalid Login or password.') expect(page).to have_content('Invalid Login or password.')
end end
it 'does not update Devise trackable attributes', :redis do 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
end end
...@@ -70,7 +70,7 @@ feature 'Login', feature: true do ...@@ -70,7 +70,7 @@ feature 'Login', feature: true do
let(:user) { create(:user, :two_factor) } let(:user) { create(:user, :two_factor) }
before do before do
login_with(user, remember: true) gitlab_sign_in(user, remember: true)
expect(page).to have_content('Two-Factor Authentication') expect(page).to have_content('Two-Factor Authentication')
end end
...@@ -167,7 +167,7 @@ feature 'Login', feature: true do ...@@ -167,7 +167,7 @@ feature 'Login', feature: true do
it 'shows 2FA prompt after OAuth login' 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]) 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') 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') expect(page).to have_content('Two-Factor Authentication')
enter_code(user.current_otp) enter_code(user.current_otp)
...@@ -180,19 +180,19 @@ feature 'Login', feature: true do ...@@ -180,19 +180,19 @@ feature 'Login', feature: true do
let(:user) { create(:user) } let(:user) { create(:user) }
it 'allows basic login' do it 'allows basic login' do
login_with(user) gitlab_sign_in(user)
expect(current_path).to eq root_path expect(current_path).to eq root_path
end end
it 'does not show a "You are already signed in." error message' do 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.') expect(page).not_to have_content('You are already signed in.')
end end
it 'blocks invalid login' do it 'blocks invalid login' do
user = create(:user, password: 'not-the-default') user = create(:user, password: 'not-the-default')
login_with(user) gitlab_sign_in(user)
expect(page).to have_content('Invalid Login or password.') expect(page).to have_content('Invalid Login or password.')
end end
end end
...@@ -209,7 +209,7 @@ feature 'Login', feature: true do ...@@ -209,7 +209,7 @@ feature 'Login', feature: true do
context 'with grace period defined' do context 'with grace period defined' do
before do before do
stub_application_setting(two_factor_grace_period: 48) stub_application_setting(two_factor_grace_period: 48)
login_with(user) gitlab_sign_in(user)
end end
context 'within the grace period' do context 'within the grace period' do
...@@ -246,7 +246,7 @@ feature 'Login', feature: true do ...@@ -246,7 +246,7 @@ feature 'Login', feature: true do
context 'without grace period defined' do context 'without grace period defined' do
before do before do
stub_application_setting(two_factor_grace_period: 0) stub_application_setting(two_factor_grace_period: 0)
login_with(user) gitlab_sign_in(user)
end end
it 'redirects to two-factor configuration page' do it 'redirects to two-factor configuration page' do
...@@ -269,7 +269,7 @@ feature 'Login', feature: true do ...@@ -269,7 +269,7 @@ feature 'Login', feature: true do
context 'with grace period defined' do context 'with grace period defined' do
before do before do
stub_application_setting(two_factor_grace_period: 48) stub_application_setting(two_factor_grace_period: 48)
login_with(user) gitlab_sign_in(user)
end end
context 'within the grace period' do context 'within the grace period' do
...@@ -310,7 +310,7 @@ feature 'Login', feature: true do ...@@ -310,7 +310,7 @@ feature 'Login', feature: true do
context 'without grace period defined' do context 'without grace period defined' do
before do before do
stub_application_setting(two_factor_grace_period: 0) stub_application_setting(two_factor_grace_period: 0)
login_with(user) gitlab_sign_in(user)
end end
it 'redirects to two-factor configuration page' do it 'redirects to two-factor configuration page' do
......
...@@ -16,7 +16,7 @@ feature 'Merge Requests > User uses quick actions', feature: true, js: true do ...@@ -16,7 +16,7 @@ feature 'Merge Requests > User uses quick actions', feature: true, js: true do
describe 'merge-request-only commands' do describe 'merge-request-only commands' do
before do before do
project.team << [user, :master] project.team << [user, :master]
login_with(user) gitlab_sign_in(user)
visit namespace_project_merge_request_path(project.namespace, project, merge_request) visit namespace_project_merge_request_path(project.namespace, project, merge_request)
end end
...@@ -52,7 +52,7 @@ feature 'Merge Requests > User uses quick actions', feature: true, js: true do ...@@ -52,7 +52,7 @@ feature 'Merge Requests > User uses quick actions', feature: true, js: true do
before do before do
project.team << [guest, :guest] project.team << [guest, :guest]
logout logout
login_with(guest) gitlab_sign_in(guest)
visit namespace_project_merge_request_path(project.namespace, project, merge_request) visit namespace_project_merge_request_path(project.namespace, project, merge_request)
end end
...@@ -98,7 +98,7 @@ feature 'Merge Requests > User uses quick actions', feature: true, js: true do ...@@ -98,7 +98,7 @@ feature 'Merge Requests > User uses quick actions', feature: true, js: true do
before do before do
project.team << [guest, :guest] project.team << [guest, :guest]
logout logout
login_with(guest) gitlab_sign_in(guest)
visit namespace_project_merge_request_path(project.namespace, project, merge_request) visit namespace_project_merge_request_path(project.namespace, project, merge_request)
end end
...@@ -127,7 +127,7 @@ feature 'Merge Requests > User uses quick actions', feature: true, js: true do ...@@ -127,7 +127,7 @@ feature 'Merge Requests > User uses quick actions', feature: true, js: true do
before do before do
logout logout
another_project.team << [user, :master] another_project.team << [user, :master]
login_with(user) gitlab_sign_in(user)
end end
it 'changes target_branch in new merge_request' do 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 ...@@ -182,7 +182,7 @@ feature 'Merge Requests > User uses quick actions', feature: true, js: true do
before do before do
project.team << [guest, :guest] project.team << [guest, :guest]
logout logout
login_with(guest) gitlab_sign_in(guest)
visit namespace_project_merge_request_path(project.namespace, project, merge_request) visit namespace_project_merge_request_path(project.namespace, project, merge_request)
end end
......
...@@ -6,7 +6,7 @@ feature 'Profile > Pipeline Quota', feature: true do ...@@ -6,7 +6,7 @@ feature 'Profile > Pipeline Quota', feature: true do
let!(:project) { create(:empty_project, namespace: namespace, shared_runners_enabled: true) } let!(:project) { create(:empty_project, namespace: namespace, shared_runners_enabled: true) }
before do before do
login_with(user) gitlab_sign_in(user)
end end
it 'is linked within the profile page' do it 'is linked within the profile page' do
......
...@@ -7,7 +7,7 @@ feature 'Projects > Audit Events', js: true, feature: true do ...@@ -7,7 +7,7 @@ feature 'Projects > Audit Events', js: true, feature: true do
before do before do
project.team << [user, :master] project.team << [user, :master]
login_with(user) gitlab_sign_in(user)
end end
describe 'adding an SSH key' do describe 'adding an SSH key' do
......
...@@ -6,7 +6,7 @@ feature 'user browses project', feature: true, js: true do ...@@ -6,7 +6,7 @@ feature 'user browses project', feature: true, js: true do
before do before do
project.team << [user, :master] project.team << [user, :master]
login_with(user) gitlab_sign_in(user)
visit namespace_project_tree_path(project.namespace, project, project.default_branch) visit namespace_project_tree_path(project.namespace, project, project.default_branch)
end end
......
...@@ -382,7 +382,7 @@ feature 'Jobs', :feature do ...@@ -382,7 +382,7 @@ feature 'Jobs', :feature do
project.update(visibility_level: Gitlab::VisibilityLevel::PUBLIC) project.update(visibility_level: Gitlab::VisibilityLevel::PUBLIC)
logout_direct logout_direct
login_with(create(:user)) gitlab_sign_in(create(:user))
visit namespace_project_job_path(project.namespace, project, job) visit namespace_project_job_path(project.namespace, project, job)
end end
......
...@@ -9,7 +9,7 @@ feature 'Path Locks', feature: true, js: true do ...@@ -9,7 +9,7 @@ feature 'Path Locks', feature: true, js: true do
allow(project).to receive(:feature_available?).with(:file_lock) { true } allow(project).to receive(:feature_available?).with(:file_lock) { true }
project.team << [user, :master] project.team << [user, :master]
login_with(user) gitlab_sign_in(user)
visit project_tree_path visit project_tree_path
end end
......
...@@ -39,7 +39,7 @@ feature 'Project', feature: true do ...@@ -39,7 +39,7 @@ feature 'Project', feature: true do
let(:project) { create(:empty_project, namespace: user.namespace) } let(:project) { create(:empty_project, namespace: user.namespace) }
before do before do
login_with user gitlab_sign_in user
create(:forked_project_link, forked_to_project: project) create(:forked_project_link, forked_to_project: project)
visit edit_namespace_project_path(project.namespace, project) visit edit_namespace_project_path(project.namespace, project)
end end
...@@ -60,7 +60,7 @@ feature 'Project', feature: true do ...@@ -60,7 +60,7 @@ feature 'Project', feature: true do
let(:project) { create(:empty_project, namespace: user.namespace, name: 'project1') } let(:project) { create(:empty_project, namespace: user.namespace, name: 'project1') }
before do before do
login_with(user) gitlab_sign_in(user)
project.team << [user, :master] project.team << [user, :master]
visit edit_namespace_project_path(project.namespace, project) visit edit_namespace_project_path(project.namespace, project)
end end
...@@ -79,7 +79,7 @@ feature 'Project', feature: true do ...@@ -79,7 +79,7 @@ feature 'Project', feature: true do
let(:project) { create(:empty_project, namespace: user.namespace) } let(:project) { create(:empty_project, namespace: user.namespace) }
before do before do
login_with(user) gitlab_sign_in(user)
project.add_user(user, Gitlab::Access::MASTER) project.add_user(user, Gitlab::Access::MASTER)
visit namespace_project_path(project.namespace, project) visit namespace_project_path(project.namespace, project)
end end
...@@ -98,7 +98,7 @@ feature 'Project', feature: true do ...@@ -98,7 +98,7 @@ feature 'Project', feature: true do
context 'on issues page', js: true do context 'on issues page', js: true do
before do before do
login_with(user) gitlab_sign_in(user)
project.add_user(user, Gitlab::Access::MASTER) project.add_user(user, Gitlab::Access::MASTER)
project2.add_user(user, Gitlab::Access::MASTER) project2.add_user(user, Gitlab::Access::MASTER)
visit namespace_project_issue_path(project.namespace, project, issue) visit namespace_project_issue_path(project.namespace, project, issue)
......
...@@ -9,7 +9,7 @@ describe "Search", feature: true do ...@@ -9,7 +9,7 @@ describe "Search", feature: true do
let!(:issue2) { create(:issue, project: project, author: user) } let!(:issue2) { create(:issue, project: project, author: user) }
before do before do
login_with(user) gitlab_sign_in(user)
project.team << [user, :reporter] project.team << [user, :reporter]
visit search_path visit search_path
end end
......
...@@ -6,7 +6,7 @@ feature 'Master creates tag', feature: true do ...@@ -6,7 +6,7 @@ feature 'Master creates tag', feature: true do
before do before do
project.team << [user, :master] project.team << [user, :master]
login_with(user) gitlab_sign_in(user)
visit namespace_project_tags_path(project.namespace, project) visit namespace_project_tags_path(project.namespace, project)
end end
......
...@@ -6,7 +6,7 @@ feature 'Master deletes tag', feature: true do ...@@ -6,7 +6,7 @@ feature 'Master deletes tag', feature: true do
before do before do
project.team << [user, :master] project.team << [user, :master]
login_with(user) gitlab_sign_in(user)
visit namespace_project_tags_path(project.namespace, project) visit namespace_project_tags_path(project.namespace, project)
end end
......
...@@ -6,7 +6,7 @@ feature 'Master updates tag', feature: true do ...@@ -6,7 +6,7 @@ feature 'Master updates tag', feature: true do
before do before do
project.team << [user, :master] project.team << [user, :master]
login_with(user) gitlab_sign_in(user)
visit namespace_project_tags_path(project.namespace, project) visit namespace_project_tags_path(project.namespace, project)
end end
......
...@@ -5,7 +5,7 @@ feature 'Master views tags', feature: true do ...@@ -5,7 +5,7 @@ feature 'Master views tags', feature: true do
before do before do
project.team << [user, :master] project.team << [user, :master]
login_with(user) gitlab_sign_in(user)
end end
context 'when project has no tags' do context 'when project has no tags' do
......
...@@ -55,7 +55,7 @@ feature 'Task Lists', feature: true do ...@@ -55,7 +55,7 @@ feature 'Task Lists', feature: true do
project.team << [user, :master] project.team << [user, :master]
project.team << [user2, :guest] project.team << [user2, :guest]
gitlab_sign_in(user) login_as(user)
end end
def visit_issue(project, issue) def visit_issue(project, issue)
...@@ -90,7 +90,7 @@ feature 'Task Lists', feature: true do ...@@ -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") expect(page).to have_selector(".wiki .task-list .task-list-item .task-list-item-checkbox")
logout(:user) logout(:user)
gitlab_sign_in(user2) login_as(user2)
visit current_path visit current_path
wait_for_requests wait_for_requests
...@@ -203,7 +203,7 @@ feature 'Task Lists', feature: true do ...@@ -203,7 +203,7 @@ feature 'Task Lists', feature: true do
logout(:user) logout(:user)
gitlab_sign_in(user2) login_as(user2)
visit current_path visit current_path
expect(page).not_to have_selector('.js-task-list-container') expect(page).not_to have_selector('.js-task-list-container')
end end
...@@ -275,7 +275,7 @@ feature 'Task Lists', feature: true do ...@@ -275,7 +275,7 @@ feature 'Task Lists', feature: true do
logout(:user) logout(:user)
gitlab_sign_in(user2) login_as(user2)
visit current_path visit current_path
expect(page).not_to have_selector('.js-task-list-container') expect(page).not_to have_selector('.js-task-list-container')
end end
......
...@@ -333,29 +333,6 @@ describe 'Dashboard Todos', feature: true do ...@@ -333,29 +333,6 @@ describe 'Dashboard Todos', feature: true do
end end
end end
context 'User have large number of todos' do
before do
create_list(:todo, 101, :mentioned, user: user, project: project, target: issue, author: author)
login_as(user)
visit dashboard_todos_path
end
it 'shows 99+ for count >= 100 in notification' do
expect(page).to have_selector('.todos-count', text: '99+')
end
it 'shows exact number in To do tab' do
expect(page).to have_selector('.todos-pending .badge', text: '101')
end
it 'shows exact number for count < 100' do
3.times { first('.js-done-todo').click }
expect(page).to have_selector('.todos-count', text: '98')
end
end
context 'User has a Build Failed todo' do context 'User has a Build Failed todo' do
let!(:todo) { create(:todo, :build_failed, user: user, project: project, author: author) } let!(:todo) { create(:todo, :build_failed, user: user, project: project, author: author) }
......
...@@ -158,7 +158,7 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', :js do ...@@ -158,7 +158,7 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', :js do
describe "when 2FA via OTP is disabled" do describe "when 2FA via OTP is disabled" do
it "allows logging in with the U2F device" do it "allows logging in with the U2F device" do
user.update_attribute(:otp_required_for_login, false) user.update_attribute(:otp_required_for_login, false)
login_with(user) gitlab_sign_in(user)
@u2f_device.respond_to_u2f_authentication @u2f_device.respond_to_u2f_authentication
...@@ -170,7 +170,7 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', :js do ...@@ -170,7 +170,7 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', :js do
describe "when 2FA via OTP is enabled" do describe "when 2FA via OTP is enabled" do
it "allows logging in with the U2F device" do it "allows logging in with the U2F device" do
user.update_attribute(:otp_required_for_login, true) user.update_attribute(:otp_required_for_login, true)
login_with(user) gitlab_sign_in(user)
@u2f_device.respond_to_u2f_authentication @u2f_device.respond_to_u2f_authentication
...@@ -180,7 +180,7 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', :js do ...@@ -180,7 +180,7 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', :js do
end end
it 'persists remember_me value via hidden field' do 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 @u2f_device.respond_to_u2f_authentication
expect(page).to have_content('We heard back from your U2F device') 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 ...@@ -308,7 +308,7 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', :js do
describe 'when no u2f device is registered' do describe 'when no u2f device is registered' do
before do before do
logout logout
login_with(user) gitlab_sign_in(user)
end end
it 'shows the fallback otp code UI' do it 'shows the fallback otp code UI' do
...@@ -321,7 +321,7 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', :js do ...@@ -321,7 +321,7 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', :js do
manage_two_factor_authentication manage_two_factor_authentication
@u2f_device = register_u2f_device @u2f_device = register_u2f_device
logout logout
login_with(user) gitlab_sign_in(user)
end end
it 'provides a button that shows the fallback otp code UI' do it 'provides a button that shows the fallback otp code UI' do
......
...@@ -24,7 +24,7 @@ feature 'Users', feature: true, js: true do ...@@ -24,7 +24,7 @@ feature 'Users', feature: true, js: true do
user.reload user.reload
expect(user.reset_password_token).not_to be_nil expect(user.reset_password_token).not_to be_nil
login_with(user) gitlab_sign_in(user)
expect(current_path).to eq root_path expect(current_path).to eq root_path
user.reload user.reload
......
...@@ -17,7 +17,7 @@ shared_examples 'issuable record that supports quick actions in its description ...@@ -17,7 +17,7 @@ shared_examples 'issuable record that supports quick actions in its description
project.team << [master, :master] project.team << [master, :master]
project.team << [assignee, :developer] project.team << [assignee, :developer]
project.team << [guest, :guest] project.team << [guest, :guest]
login_with(master) gitlab_sign_in(master)
end end
after do after do
...@@ -106,7 +106,7 @@ shared_examples 'issuable record that supports quick actions in its description ...@@ -106,7 +106,7 @@ shared_examples 'issuable record that supports quick actions in its description
context "when current user cannot close #{issuable_type}" do context "when current user cannot close #{issuable_type}" do
before do before do
logout logout
login_with(guest) gitlab_sign_in(guest)
visit public_send("namespace_project_#{issuable_type}_path", project.namespace, project, issuable) visit public_send("namespace_project_#{issuable_type}_path", project.namespace, project, issuable)
end end
...@@ -141,7 +141,7 @@ shared_examples 'issuable record that supports quick actions in its description ...@@ -141,7 +141,7 @@ shared_examples 'issuable record that supports quick actions in its description
context "when current user cannot reopen #{issuable_type}" do context "when current user cannot reopen #{issuable_type}" do
before do before do
logout logout
login_with(guest) gitlab_sign_in(guest)
visit public_send("namespace_project_#{issuable_type}_path", project.namespace, project, issuable) visit public_send("namespace_project_#{issuable_type}_path", project.namespace, project, issuable)
end end
...@@ -171,7 +171,7 @@ shared_examples 'issuable record that supports quick actions in its description ...@@ -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 context "when current user cannot change title of #{issuable_type}" do
before do before do
logout logout
login_with(guest) gitlab_sign_in(guest)
visit public_send("namespace_project_#{issuable_type}_path", project.namespace, project, issuable) visit public_send("namespace_project_#{issuable_type}_path", project.namespace, project, issuable)
end end
......
...@@ -14,7 +14,7 @@ module LoginHelpers ...@@ -14,7 +14,7 @@ module LoginHelpers
# # Provide an existing User record # # Provide an existing User record
# user = create(:user) # user = create(:user)
# gitlab_sign_in(user) # gitlab_sign_in(user)
def gitlab_sign_in(user_or_role) def gitlab_sign_in(user_or_role, **kwargs)
@user = @user =
if user_or_role.is_a?(User) if user_or_role.is_a?(User)
user_or_role user_or_role
...@@ -22,7 +22,7 @@ module LoginHelpers ...@@ -22,7 +22,7 @@ module LoginHelpers
create(user_or_role) create(user_or_role)
end end
gitlab_sign_in_with(@user) gitlab_sign_in_with(@user, **kwargs)
end end
def gitlab_sign_in_via(provider, user, uid) def gitlab_sign_in_via(provider, user, uid)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment