18 lines
627 B
Ruby
18 lines
627 B
Ruby
|
# frozen_string_literal: true
|
|||
|
|
|||
|
class UserMailerTest < ActionMailer::TestCase
|
|||
|
test "password resets can’t 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
|