gitlab-org--gitlab-foss/spec/support/login_helpers.rb
ash wilson c8a115c0e3 Link issues from comments and automatically close them
Any mention of Issues, MergeRequests, or Commits via GitLab-flavored markdown
references in descriptions, titles, or attached Notes creates a back-reference
Note that links to the original referencer. Furthermore, pushing commits with
commit messages that match a (configurable) regexp to a project's default
branch will close any issues mentioned by GFM in the matched closing phrase.
If accepting a merge request would close any Issues in this way, a banner is
appended to the merge request's main panel to indicate this.
2013-08-25 18:58:41 -04:00

27 lines
636 B
Ruby

module LoginHelpers
# Internal: Create and log in as a user of the specified role
#
# role - User role (e.g., :admin, :user)
def login_as(role)
ActiveRecord::Base.observers.enable(:user_observer) do
@user = create(role)
end
login_with(@user)
end
# Internal: Login as the specified user
#
# user - User instance to login with
def login_with(user)
visit new_user_session_path
fill_in "user_login", with: user.email
fill_in "user_password", with: "123456"
click_button "Sign in"
Thread.current[:current_user] = user
end
def logout
click_link "Logout" rescue nil
end
end