We will use fabrication as object factory. New user fabricator.
This commit is contained in:
2
Gemfile
2
Gemfile
@ -51,6 +51,8 @@ gem "rails-erd", group: :development
|
||||
|
||||
gem 'travis-lint'
|
||||
|
||||
gem 'faker'
|
||||
gem 'fabrication'
|
||||
|
||||
group :development do
|
||||
gem "binding_of_caller"
|
||||
|
||||
@ -89,6 +89,9 @@ GEM
|
||||
erubis (2.7.0)
|
||||
eventmachine (1.0.0)
|
||||
execjs (2.0.2)
|
||||
fabrication (2.9.1)
|
||||
faker (1.2.0)
|
||||
i18n (~> 0.5)
|
||||
foreman (0.63.0)
|
||||
dotenv (>= 0.7)
|
||||
thor (>= 0.13.6)
|
||||
@ -244,6 +247,8 @@ DEPENDENCIES
|
||||
dalli
|
||||
devise_browserid_authenticatable
|
||||
dotenv-rails
|
||||
fabrication
|
||||
faker
|
||||
foreman
|
||||
haml-rails
|
||||
has_scope
|
||||
|
||||
16
spec/fabricators/user_fabricator.rb
Normal file
16
spec/fabricators/user_fabricator.rb
Normal file
@ -0,0 +1,16 @@
|
||||
Fabricator(:user) do
|
||||
transient :with_profile => true
|
||||
|
||||
Faker::Config.locale = :es
|
||||
|
||||
username { Faker::Internet.user_name }
|
||||
email { Faker::Internet.email }
|
||||
date_of_birth { DateTime.now.utc }
|
||||
identity_document { sequence(:identity_document, 1) { |n| "X000000#{n}X" } }
|
||||
phone { Faker::PhoneNumber.phone_number }
|
||||
alt_phone { Faker::PhoneNumber.cell_phone }
|
||||
address { Faker::Address.street_address + " " + Faker::Address.zip_code + " " + Faker::Address.city + " (" + Faker::Address.state + ")"}
|
||||
gender { ["male", "female"].shuffle.first }
|
||||
description { Faker::Lorem.paragraph }
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user