gitlab-org--gitlab-foss/features/steps/shared/authentication.rb

39 lines
681 B
Ruby
Raw Normal View History

2012-09-10 11:35:03 -04:00
require Rails.root.join('spec', 'support', 'login_helpers')
module SharedAuthentication
include Spinach::DSL
include LoginHelpers
step 'I sign in as a user' do
2012-09-10 11:35:03 -04:00
login_as :user
end
step 'I sign in as an admin' do
login_as :admin
end
2012-09-27 16:23:11 -04:00
2014-02-07 11:59:55 -05:00
step 'I sign in as "John Doe"' do
login_with(user_exists("John Doe"))
end
step 'I sign in as "Mary Jane"' do
login_with(user_exists("Mary Jane"))
end
step 'I should be redirected to sign in page' do
expect(current_path).to eq new_user_session_path
end
2014-06-26 03:49:14 -04:00
step "I logout" do
logout
end
step "I logout directly" do
logout_direct
end
2012-09-27 16:23:11 -04:00
def current_user
@user || User.first
end
2012-09-10 11:35:03 -04:00
end