2
我User.rb有:廠將不設置密碼,password_confirmation
attr_accessor :password, :password_confirmation
attr_accessible :password, :password_confirmation
我的用戶factory_girl是:
Factory.define :user do |u|
u.password "my_password"
u.password_confirmation "my_password"
end
我User.rb設置encrypted_password場當對象保存。
看來,當我在我的工廠(密碼)設置的值,根本沒有被設置。
在我的測試中,我所要做的:
it "should ...." do
user = Factory(:user)
user.password = "abc123"
end
爲什麼會是這種情況?
我有密碼屬性作爲訪問者和可訪問。
是否有衝突?
你使用任何一種認證寶石或代碼? – nowk 2011-06-08 00:08:08
Nowk沒有什麼應該是衝突...(它是我自己的習慣) – Blankman 2011-06-08 00:43:02