From 3b12614dd0ca377e7dc8c57ba9221a56538e5816 Mon Sep 17 00:00:00 2001 From: Robert Keresnyei Date: Wed, 24 Jan 2024 13:23:44 +0100 Subject: [PATCH] Add only_path param to system test helpers (#197) --- lib/passwordless/test_helpers.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/passwordless/test_helpers.rb b/lib/passwordless/test_helpers.rb index 1be852b..4e96f8d 100644 --- a/lib/passwordless/test_helpers.rb +++ b/lib/passwordless/test_helpers.rb @@ -43,21 +43,22 @@ def passwordless_sign_in(resource) end module SystemTestCase - def passwordless_sign_out(cls = nil) + 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")) + visit(Passwordless.context.url_for(resource, action: "destroy", only_path: only_path)) end - def passwordless_sign_in(resource) + 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 + token: session.token, + only_path: only_path ) visit(magic_link)