2016-12-15 18:07:51 +08:00
|
|
|
require 'faker'
|
2016-12-11 15:56:58 +08:00
|
|
|
FactoryGirl.define do
|
|
|
|
factory :user do
|
|
|
|
name { Faker::Name.name }
|
|
|
|
email { Faker::Internet.email }
|
|
|
|
password 'secret'
|
|
|
|
password_confirmation 'secret'
|
2016-12-26 10:44:14 +08:00
|
|
|
phone '13712345678'
|
2016-12-11 15:56:58 +08:00
|
|
|
|
|
|
|
factory :user_with_sequence_number do
|
|
|
|
sequence(:email){ |n| "email#{n}@example.com" }
|
|
|
|
sequence(:name){ |n| "username#{n}"}
|
|
|
|
end
|
|
|
|
|
2016-12-11 17:40:47 +08:00
|
|
|
factory :user_name_length_gt_30 do
|
2016-12-15 09:56:40 +08:00
|
|
|
name Faker::Internet.password(31, 31)
|
2016-12-11 15:56:58 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
factory :user_email_length_gt_50 do
|
|
|
|
email '12345678901234567890123456789012345678901234567890@qq.com'
|
|
|
|
end
|
|
|
|
|
|
|
|
factory :user_password_length_lt_6 do
|
|
|
|
password { Faker::Internet.password( 0, 5 ) }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|