mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-06 02:51:34 +00:00
Bring payment factory from spree_core and merge with modification
This commit is contained in:
@@ -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
|
||||
|
||||
25
spec/factories/payment_factory.rb
Normal file
25
spec/factories/payment_factory.rb
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user