开发者

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜