1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
FactoryGirl.define do
factory :user do
username 'testuser'
sequence(:email) { |n| "user#{n}@domain.com" }
password 'some_password'
password_confirmation 'some_password'
facebook_token { SecureRandom.hex }
ignore do
confirm_account true
end
after(:create) do |u, evaluator|
u.confirm if evaluator.confirm_account
end
trait :with_reset_password_token do
reset_password_token { SecureRandom.hex }
end
trait :with_authentication_token do
authentication_token { SecureRandom.hex }
authentication_token_created_at { Time.now }
end
trait :with_day_old_token do
authentication_token { SecureRandom.hex }
authentication_token_created_at { Time.now - 1.day }
end
end
end
|