Sha256: 86f2bcca542f13351c0fb35fd44069b3ffb5bb4d22c7f30489b62c32011bc93f
Contents?: true
Size: 738 Bytes
Versions: 21
Compression:
Stored size: 738 Bytes
Contents
# frozen_string_literal: true FactoryBot.define do factory :user, class: Spree::UserClassHandle.new do email { generate(:email) } password { 'secret' } password_confirmation { password } trait :with_api_key do after(:create) do |user, _| user.generate_spree_api_key! end end trait :with_orders do after(:create) do |user, _| create(:order, user: user) end end factory :admin_user do after(:create) do |user, _| admin_role = Spree::Role.find_by(name: 'admin') || create(:role, name: 'admin') user.spree_roles << admin_role end end factory :user_with_addresses do |_u| bill_address ship_address end end end
Version data entries
21 entries across 21 versions & 1 rubygems