2012-09-10 15:35:03 +00:00
|
|
|
require Rails.root.join('spec', 'support', 'login_helpers')
|
|
|
|
|
|
|
|
module SharedAuthentication
|
|
|
|
include Spinach::DSL
|
|
|
|
include LoginHelpers
|
|
|
|
|
2014-09-21 21:40:22 +00:00
|
|
|
step 'I sign in as a user' do
|
2012-09-10 15:35:03 +00:00
|
|
|
login_as :user
|
|
|
|
end
|
2012-09-26 00:11:57 +00:00
|
|
|
|
2014-09-21 21:40:22 +00:00
|
|
|
step 'I sign in as an admin' do
|
2012-09-26 00:11:57 +00:00
|
|
|
login_as :admin
|
|
|
|
end
|
2012-09-27 20:23:11 +00:00
|
|
|
|
2014-02-07 16:59:55 +00: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
|
|
|
|
|
2013-12-03 14:22:33 +00:00
|
|
|
step 'I should be redirected to sign in page' do
|
|
|
|
current_path.should == new_user_session_path
|
|
|
|
end
|
|
|
|
|
2014-06-26 07:49:14 +00:00
|
|
|
step "I logout" do
|
|
|
|
logout
|
|
|
|
end
|
|
|
|
|
2012-09-27 20:23:11 +00:00
|
|
|
def current_user
|
|
|
|
@user || User.first
|
|
|
|
end
|
2012-09-10 15:35:03 +00:00
|
|
|
end
|