diff --git a/spec/factories.rb b/spec/factories.rb index b9cf3658e6..f705ad1292 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -162,17 +162,6 @@ FactoryBot.define do end FactoryBot.modify do - factory :payment do - transient do - distributor { - order.distributor || - Enterprise.is_distributor.first || - FactoryBot.create(:distributor_enterprise) - } - end - payment_method { FactoryBot.create(:payment_method, distributors: [distributor]) } - end - factory :payment_method do distributors { [Enterprise.is_distributor.first || FactoryBot.create(:distributor_enterprise)] } end diff --git a/spec/factories/payment_factory.rb b/spec/factories/payment_factory.rb new file mode 100644 index 0000000000..267f63a7af --- /dev/null +++ b/spec/factories/payment_factory.rb @@ -0,0 +1,25 @@ +FactoryGirl.define do + factory :payment, class: Spree::Payment do + transient do + distributor { + order.distributor || + Enterprise.is_distributor.first || + FactoryBot.create(:distributor_enterprise) + } + end + + amount 45.75 + association(:source, factory: :credit_card) + order + state 'checkout' + response_code '12345' + + payment_method { FactoryBot.create(:payment_method, distributors: [distributor]) } + end + + factory :check_payment, class: Spree::Payment do + amount 45.75 + payment_method + order + end +end