Reputation: 8304
I'm trying to build a factory for an "account" model defined with authlogic:
class Account < UuidEnabled
acts_as_authentic do |c|
c.validate_password_field = true
c.require_password_confirmation = true
c.ignore_blank_passwords = false
c.crypto_provider = Authlogic::CryptoProviders::Sha512
end
end
This is my factory:
FactoryGirl.define do
factory :account do
sequence(:email) { |n| "account_#{n}@example.com"}
password = "1234"
password_confirmation { |a| a.password} # to make things work even if the password is changed
end
end
My test fails with
ActiveRecord::RecordInvalid: Validation failed: Password is too short (minimum is 4 characters), Password confirmation is too short (minimum is 4 characters)
Upvotes: 0
Views: 535
Reputation: 5015
Think this is just a typo, try:
FactoryGirl.define do
factory :account do
sequence(:email) { |n| "account_#{n}@example.com"}
password "1234"
password_confirmation { |a| a.password} # to make things work even if the password is changed
end
end
Note that the equals sign after password
has been removed
Upvotes: 1
Reputation: 1318
Have you tried setting attr_accessible :password
in the Account model?
Upvotes: 0