tabletop-companion/test/mailers/user_mailer_test.rb

18 lines
627 B
Ruby
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# frozen_string_literal: true
class UserMailerTest < ActionMailer::TestCase
test "password resets cant be resent within 10 minutes" do
user = users(:trevor)
assert_emails(+1) do
UserMailer.with(user: user, token: user.generate_token_for(:password_reset)).password_reset.deliver_now
end
assert_emails(0) do
UserMailer.with(user: user, token: user.generate_token_for(:password_reset)).password_reset.deliver_now
end
travel 11.minutes
assert_emails(+1) do
UserMailer.with(user: user, token: user.generate_token_for(:password_reset)).password_reset.deliver_now
end
end
end