Sha256: b7ddf100e93bd6add4c0b82928fb5aae5f8032a75475ea7f84ab404a17600e00

Contents?: true

Size: 1.6 KB

Versions: 2

Compression:

Stored size: 1.6 KB

Contents

FactoryGirl.define do
  factory :admin_user, :class => User do |user|
    user.name 'Admin'
    user.email { FactoryGirl.generate(:email) }
    user.password               'password'
    user.password_confirmation  'password'
    
    user.after(:build) do |u| 
      u.roles.build(:role_type => RoleType.admin)
      u.skip_confirmation!
    end
  end

  factory :redactor_user, :class => User do |user|
    user.name 'Redactor'
    user.email { FactoryGirl.generate(:email) }
    user.password               'password'
    user.password_confirmation  'password'
    
    user.after(:build) do |u| 
      u.roles.build(:role_type => RoleType.redactor)
      u.skip_confirmation!
    end
  end

  factory :moderator_user, :class => User do |user|
    user.name 'Redactor'
    user.email { FactoryGirl.generate(:email) }
    user.password               'password'
    user.password_confirmation  'password'
    
    user.after(:build) do |u| 
      u.roles.build(:role_type => RoleType.moderator)
      u.skip_confirmation!
    end
  end

  factory :default_user, :class => User do |user|
    user.name 'Test'
    user.email { FactoryGirl.generate(:email) }
    user.password               'password'
    user.password_confirmation  'password'
    
    user.after(:build) do |u| 
      u.roles.build(:role_type => RoleType.default)
      u.skip_confirmation!
    end
  end

  factory :user, :class => User do |user|
    user.name 'Test'
    user.email { FactoryGirl.generate(:email) }
    user.password               'password'
    user.password_confirmation  'password'
  end

  sequence :email do |n|
    "testing#{n}@example.com"
  end
end

Version data entries

2 entries across 1 versions & 1 rubygems

Version Path
sunrise-cms-0.3.0.rc lib/generators/sunrise/templates/spec/factories/user_factory.rb
sunrise-cms-0.3.0.rc spec/tmp/spec/factories/user_factory.rb