Sha256: 4bac200c18c43f03f4648009596bf1f2de5ad3f410b154c28b24dee525fdc7e2

Contents?: true

Size: 1.07 KB

Versions: 2

Compression:

Stored size: 1.07 KB

Contents

require 'factory_girl'

#
# User
#
Factory.define :blank_user, class: 'Models::User' do |u|
  u.sequence(:name){|i| "user#{i}"}
end

Factory.define :new_user, class: 'Models::User' do |u|
  u.sequence(:name){|i| "user#{i}"}
  u.sequence(:email){|i| "user#{i}@email.com"}
  u.sequence(:password){|i| "user#{i}"}
  u.password_confirmation{|_self| _self.password}
end

Factory.define :user, parent: :new_user do |u|
  u.state 'active'
end

Factory.define :open_id_user, class: 'Models::User' do |u|
  u.sequence(:name){|i| "user#{i}"}
  u.sequence(:open_ids){|i| ["open_id_#{i}"]}
  u.state 'active'
end

Factory.define :anonymous, parent: :new_user do |u|
  u.name 'anonymous'
  u.email "anonymous@mail.com"
  u.password "anonymous_password"
  u.password_confirmation{|_self| _self.password}
end

Factory.define :admin, parent: :new_user do |u|
  u.admin true
end

Factory.define :member, parent: :new_user do |u|
  u.roles{%w{member}}
end

Factory.define :manager, parent: :member do |u|
  u.roles{%w{manager}}
end

Factory.define :global_admin, parent: :new_user do |u|
  u.global_admin true
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rad_users-0.0.2 lib/users/factories.rb
rad_users-0.0.1 lib/users/factories.rb