osem-fcy/spec/support/login_macros.rb

18 lines
465 B
Ruby
Raw Normal View History

2014-05-10 17:54:56 +02:00
module LoginMacros
def sign_in(user)
visit new_user_session_path
fill_in 'user_email', with: user.email
fill_in 'user_password', with: user.password
2014-06-18 16:58:30 +03:00
find(:xpath, "//div[@id='content']//button[@type='submit']").click
2014-05-10 17:54:56 +02:00
expect(page.has_content?('Signed in successfully')).to be true
end
def sign_out
Capybara.current_session.driver.browser.clear_cookies
visit root_path
expect(page.has_content?('Sign In')).to be true
end
2014-05-10 17:54:56 +02:00
end