We will use fabrication as object factory. New user fabricator.

This commit is contained in:
amartincaro
2013-11-05 19:31:40 +01:00
parent 4c1d059b6e
commit 45d51e7fb4
3 changed files with 23 additions and 0 deletions

View File

@ -51,6 +51,8 @@ gem "rails-erd", group: :development
gem 'travis-lint'
gem 'faker'
gem 'fabrication'
group :development do
gem "binding_of_caller"

View File

@ -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

View 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