tabletop-companion/test/mailers/user_mailer_test.rb

18 lines
627 B
Ruby
Raw Normal View History

# 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