Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unknown email sender config #225

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
Add test for sending paranoid email with send_paranoid_email config e…
…nabled
  • Loading branch information
Dakota-Schramm committed May 3, 2024
commit ea1ba19bdf41612e8b81ef457e7ad7c3573f366f
18 changes: 17 additions & 1 deletion test/controllers/passwordless/sessions_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,31 @@ class << User
post("/users/sign_in", params: {passwordless: {email: "a@a"}})
end

assert_equal 1, ActionMailer::Base.deliveries.size
assert_equal 302, status

assert_equal 0, ActionMailer::Base.deliveries.size
assert_nil Session.last.authenticatable

follow_redirect!
assert_equal "/users/sign_in/#{Session.last!.identifier}", path
end

test("POST /:passwordless_for/sign_in -> SUCCESS / not found,
paranoid enabled, send paranoid email") do
with_config(paranoid: true, send_paranoid_email: true) do
post("/users/sign_in", params: {passwordless: {email: "a@a"}})
end

assert_equal 1, ActionMailer::Base.deliveries.size
assert_nil Session.last.authenticatable

assert_equal 302, status

follow_redirect!
assert_equal "/users/sign_in/#{Session.last!.identifier}", path
end


test("POST /:passwordless_for/sign_in -> ERROR / not found and paranoid disabled") do
post("/users/sign_in", params: {passwordless: {email: "A@a"}})

Expand Down