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 ()
  if page.driver.is_a?(Capybara::RackTest::Driver)
    disable_forgery_protection do
      page.driver.send(:post, aikotoba.new_session_path, account: {email: .email, password: .password})
    end
  else
    raise NotImplementedError, "Sorry. Only RackTest::Driver is supported as a test helper for Aikotoba's authentication."
  end
end

#aikotoba_sign_outObject



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