summaryrefslogtreecommitdiff
path: root/spec/ci/support/login_helpers.rb
blob: ebd9693f8a4a01c5438b814660a3240687190317 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
module LoginHelpers
  def login_as(role)
    raise 'Only :user allowed' unless role == :user
    stub_gitlab_calls
    login_with(:user)
  end

  # Internal: Login as the specified user
  #
  # user - User instance to login with
  def login_with(user)
    visit callback_user_sessions_path(code: "some_auth_code_here")
  end

  def logout
    click_link "Logout" rescue nil
  end

  def skip_admin_auth
    ApplicationController.any_instance.stub(authenticate_admin!: true)
  end
end