forked from e621ng/e621ng

The newly included create method behaves exacly like the self-written one, with the added benefit of it not appearing in backtraces.
23 lines
524 B
Ruby
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
|