eBooru/test/unit/user_password_reset_nonce_test.rb
Earlopain 87313c437c [Tests] Include FactoryBot::Syntax::Methods
The newly included create method behaves exacly like the self-written one,
with the added benefit of it not appearing in backtraces.
2022-11-25 21:06:54 +01:00

23 lines
524 B
Ruby

require 'test_helper'
class UserPasswordResetNonceTest < ActiveSupport::TestCase
context "Creating a new nonce" do
setup do
@user = create(:user)
@nonce = create(:user_password_reset_nonce, user: @user)
end
should "validate" do
assert_equal([], @nonce.errors.full_messages)
end
should "populate the key with a random string" do
assert_equal(24, @nonce.key.size)
end
should "reset the password when reset" do
@nonce.reset_user! "test", "test"
end
end
end