Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ci/support/login_helpers.rb')
-rw-r--r--spec/ci/support/login_helpers.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/ci/support/login_helpers.rb b/spec/ci/support/login_helpers.rb
new file mode 100644
index 00000000000..ebd9693f8a4
--- /dev/null
+++ b/spec/ci/support/login_helpers.rb
@@ -0,0 +1,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