debian-mirror-gitlab/features/steps/shared/authentication.rb

39 lines
681 B
Ruby
Raw Normal View History

2014-09-02 18:07:02 +05:30
require Rails.root.join('spec', 'support', 'login_helpers')
module SharedAuthentication
include Spinach::DSL
include LoginHelpers
2015-04-26 12:48:37 +05:30
step 'I sign in as a user' do
2014-09-02 18:07:02 +05:30
login_as :user
end
2015-04-26 12:48:37 +05:30
step 'I sign in as an admin' do
2014-09-02 18:07:02 +05:30
login_as :admin
end
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
2015-09-11 14:41:01 +05:30
expect(current_path).to eq new_user_session_path
2014-09-02 18:07:02 +05:30
end
step "I logout" do
logout
end
2015-09-11 14:41:01 +05:30
step "I logout directly" do
logout_direct
end
2014-09-02 18:07:02 +05:30
def current_user
@user || User.first
end
end