Module: Aikotoba::Test::AuthenticationHelper::System
- Defined in:
- lib/aikotoba/test/authentication_helper.rb
Instance Method Summary collapse
Instance Method Details
#aikotoba_sign_in(account) ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/aikotoba/test/authentication_helper.rb', line 27 def aikotoba_sign_in(account) if page.driver.is_a?(Capybara::RackTest::Driver) disable_forgery_protection do page.driver.send(:post, aikotoba.new_session_path, account: {email: account.email, password: account.password}) end else raise NotImplementedError, "Sorry. Only RackTest::Driver is supported as a test helper for Aikotoba's authentication." end end |
#aikotoba_sign_out ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/aikotoba/test/authentication_helper.rb', line 19 def aikotoba_sign_out if page.driver.is_a?(Capybara::RackTest::Driver) disable_forgery_protection { page.driver.send(:delete, aikotoba.destroy_session_path) } else raise NotImplementedError, "Sorry. Only RackTest::Driver is supported as a test helper for Aikotoba's authentication." end end |