Sha256: 4c3e6ab9c67e59d9b7f3b2b57c1df4cbb1540f7d0eebe6358e7c88e636337fb6
Contents?: true
Size: 1.06 KB
Versions: 22
Compression:
Stored size: 1.06 KB
Contents
FactoryBot.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 first_name { FFaker::Name.first_name } last_name { FFaker::Name.last_name } public_metadata { {} } private_metadata { {} } 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 after(:create) do |user| user.ship_address = create(:address, user: user) user.bill_address = create(:address, user: user) user.addresses << user.ship_address user.addresses << user.bill_address user.save end end end end
Version data entries
22 entries across 22 versions & 1 rubygems
Version | Path |
---|---|
spree_core-4.5.1 | lib/spree/testing_support/factories/user_factory.rb |
spree_core-4.5.0 | lib/spree/testing_support/factories/user_factory.rb |