Sha256: 8edbd9a00c96b8ee7c8b8f2ad1e0ed913598bb4965c94d307304c87eb9dcf7f4

Contents?: true

Size: 564 Bytes

Versions: 3

Compression:

Stored size: 564 Bytes

Contents

FactoryGirl.define do
  sequence :user_authentication_token do |n|
    "xxxx#{Time.now.to_i}#{rand(1000)}#{n}xxxxxxxxxxxxx"
  end

  factory :user, :class => Spree::User do
    email { Faker::Internet.email }
    login { email }
    password 'secret'
    password_confirmation 'secret'
    authentication_token { FactoryGirl.generate(:user_authentication_token) } if Spree::User.attribute_method? :authentication_token
  end

  factory :admin_user, :parent => :user do
    roles { [Spree::Role.find_by_name('admin') || Factory(:role, :name => 'admin')]}
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spree_core-1.1.0 lib/spree/core/testing_support/factories/user_factory.rb
spree_core-1.1.0.rc2 lib/spree/core/testing_support/factories/user_factory.rb
spree_core-1.1.0.rc1 lib/spree/core/testing_support/factories/user_factory.rb