Sha256: 874195fa3d8990cecccfda5fab50e9d62ef0a1f06f93aae27339837872386764

Contents?: true

Size: 676 Bytes

Versions: 43

Compression:

Stored size: 676 Bytes

Contents

FactoryGirl.define do
  sequence :user_authentication_token do |n|
    "xxxx#{Time.current.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

    factory :user_with_addresses, aliases: [:user_with_addreses] do
      ship_address
      bill_address
    end
  end
end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
spree_core-3.1.14 lib/spree/testing_support/factories/user_factory.rb
spree_core-3.1.13 lib/spree/testing_support/factories/user_factory.rb
spree_core-3.3.4 lib/spree/testing_support/factories/user_factory.rb
spree_core-3.2.7 lib/spree/testing_support/factories/user_factory.rb
spree_core-3.1.12 lib/spree/testing_support/factories/user_factory.rb
spree_core-3.3.3 lib/spree/testing_support/factories/user_factory.rb
spree_core-3.2.6 lib/spree/testing_support/factories/user_factory.rb
spree_core-3.1.11 lib/spree/testing_support/factories/user_factory.rb
spree_core-3.4.1 lib/spree/testing_support/factories/user_factory.rb
spree_core-3.4.0 lib/spree/testing_support/factories/user_factory.rb
spree_core-3.4.0.rc2 lib/spree/testing_support/factories/user_factory.rb
spree_core-3.1.10 lib/spree/testing_support/factories/user_factory.rb
spree_core-3.4.0.rc1 lib/spree/testing_support/factories/user_factory.rb
spree_core-3.3.2 lib/spree/testing_support/factories/user_factory.rb
spree_core-3.2.5 lib/spree/testing_support/factories/user_factory.rb
spree_core-3.1.9 lib/spree/testing_support/factories/user_factory.rb
spree_core-3.3.1 lib/spree/testing_support/factories/user_factory.rb
spree_core-3.2.4 lib/spree/testing_support/factories/user_factory.rb
spree_core-3.1.8 lib/spree/testing_support/factories/user_factory.rb
spree_core-3.3.0 lib/spree/testing_support/factories/user_factory.rb