Sha256: b37f45415c64cd453c1d3a8481d48013d94c3b1644c3b965719ec33eb3598337

Contents?: true

Size: 575 Bytes

Versions: 7

Compression:

Stored size: 575 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') || FactoryGirl.create(:role, :name => 'admin')]}
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
spree_core-1.1.6 lib/spree/core/testing_support/factories/user_factory.rb
spree_core-1.1.5 lib/spree/core/testing_support/factories/user_factory.rb
spree_core-1.1.4 lib/spree/core/testing_support/factories/user_factory.rb
spree_core-1.1.3 lib/spree/core/testing_support/factories/user_factory.rb
spree_core-1.1.2 lib/spree/core/testing_support/factories/user_factory.rb
spree_core-1.1.2.rc1 lib/spree/core/testing_support/factories/user_factory.rb
spree_core-1.1.1 lib/spree/core/testing_support/factories/user_factory.rb