Sha256: e25ce7c6e6df7335045d00ebf46cd24aac5bb3c9d4623da46c4a90a5613c9756

Contents?: true

Size: 557 Bytes

Versions: 14

Compression:

Stored size: 557 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_class do
    email { generate(:random_email) }
    login { email }
    password 'secret'
    password_confirmation { password }
    authentication_token { generate(:user_authentication_token) } if Spree.user_class.attribute_method? :authentication_token

    factory :admin_user do
      spree_roles { [Spree::Role.find_by(name: 'admin') || create(:role, name: 'admin')] }
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
spree_core-2.1.12 lib/spree/testing_support/factories/user_factory.rb
spree_core-2.1.11 lib/spree/testing_support/factories/user_factory.rb
spree_core-2.1.10 lib/spree/testing_support/factories/user_factory.rb
spree_core-2.1.9 lib/spree/testing_support/factories/user_factory.rb
spree_core-2.1.8 lib/spree/testing_support/factories/user_factory.rb
spree_core-2.1.7 lib/spree/testing_support/factories/user_factory.rb
spree_core-2.1.6 lib/spree/testing_support/factories/user_factory.rb
spree_core-2.2.0 lib/spree/testing_support/factories/user_factory.rb
spree_core-2.1.5 lib/spree/testing_support/factories/user_factory.rb
spree_core-2.1.4 lib/spree/testing_support/factories/user_factory.rb
spree_core-2.1.3 lib/spree/testing_support/factories/user_factory.rb
spree_core-2.1.2 lib/spree/testing_support/factories/user_factory.rb
spree_core-2.1.1 lib/spree/testing_support/factories/user_factory.rb
spree_core-2.1.0 lib/spree/testing_support/factories/user_factory.rb