How to test the Model has has_secure_password?
Lets say I have User model as below..
class User < ActiveRec开发者_开发百科ord::Base
has_secure_password
end
I would like to test whether User
has has_secure_password
but not sure how to do it. And I don't want to test what rails has been tested.
Thanks in advance.
What I have been doing is just checking if the object responds to authenticate and has the password_digest field.
test "user model has secure password" do
assert_respond_to @user, :password_digest
assert_respond_to @user, :authenticate, "User requires has_secure_password"
end
精彩评论