Module: Passwordless::TestHelpers::SystemTestCase
- Defined in:
- lib/passwordless/test_helpers.rb
Instance Method Summary collapse
- #passwordless_sign_in(resource, only_path: false) ⇒ Object
- #passwordless_sign_out(cls = nil, only_path: false) ⇒ Object
Instance Method Details
#passwordless_sign_in(resource, only_path: false) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/passwordless/test_helpers.rb', line 53 def passwordless_sign_in(resource, only_path: false) session = Passwordless::Session.create!(authenticatable: resource) magic_link = Passwordless.context.url_for( session, action: "confirm", id: session.to_param, token: session.token, only_path: only_path ) visit(magic_link) end |
#passwordless_sign_out(cls = nil, only_path: false) ⇒ Object
46 47 48 49 50 51 |
# File 'lib/passwordless/test_helpers.rb', line 46 def passwordless_sign_out(cls = nil, only_path: false) cls ||= "User".constantize resource = cls.model_name.to_s.tableize visit(Passwordless.context.url_for(resource, action: "destroy", only_path: only_path)) end |