0
測試我有魔法
一個小問題,這是我的測試:如何與巫術
def setup
@user = users(:anouar)
end
test "should be valid" do
assert @user.valid?
end
,這是我的燈具:
anouar:
email: [email protected]
salt: <%= salt = "asdasdastr4325234324sdfds" %>
crypted_password: <%= Sorcery::CryptoProviders::BCrypt.encrypt("secret", salt) %>
和我的模型:
class User < ActiveRecord::Base
authenticates_with_sorcery!
validates :email, presence: true, length: { maximum: 255 },
email_format: { message: 'has invalid format' },
uniqueness: { case_sensitive: false }
end
直到這裏當我運行bundle exec耙測試測試是綠色的
但是當我加密碼
validates :password, presence: true, confirmation: true, length: { minimum: 3}
測試的驗證「應該是有效的」,是失敗
請幫助?