mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-04 02:31:33 +00:00
Add vine_voucher factory
This commit is contained in:
committed by
Rachel Arnould
parent
7726c7d129
commit
b42cba8c37
@@ -499,8 +499,7 @@ RSpec.describe CheckoutController, type: :controller do
|
||||
|
||||
context "with a VINE voucher", feature: :connected_apps do
|
||||
let(:vine_voucher) {
|
||||
create(:voucher_flat_rate, voucher_type: "VINE", code: 'some_code',
|
||||
enterprise: distributor, amount: 6)
|
||||
create(:vine_voucher, code: 'some_code', enterprise: distributor, amount: 6)
|
||||
}
|
||||
let(:vine_voucher_redeemer) { instance_double(Vine::VoucherRedeemerService) }
|
||||
|
||||
|
||||
@@ -14,4 +14,10 @@ FactoryBot.define do
|
||||
factory :voucher_percentage_rate, parent: :voucher, class: Vouchers::PercentageRate do
|
||||
amount { rand(1..100) }
|
||||
end
|
||||
|
||||
factory :vine_voucher, parent: :voucher_flat_rate do
|
||||
voucher_type { Voucher::VINE_TYPE }
|
||||
external_voucher_id { SecureRandom.uuid }
|
||||
external_voucher_set_id { SecureRandom.uuid }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -73,8 +73,7 @@ RSpec.describe Spree::Admin::PaymentsController, type: :request do
|
||||
|
||||
context "with a VINE voucher", feature: :connected_apps do
|
||||
let(:vine_voucher) {
|
||||
create(:voucher_flat_rate, voucher_type: "VINE", code: 'some_code',
|
||||
enterprise: order.distributor, amount: 6)
|
||||
create(:vine_voucher, code: 'some_code', enterprise: order.distributor, amount: 6)
|
||||
}
|
||||
let(:vine_voucher_redeemer) { instance_double(Vine::VoucherRedeemerService) }
|
||||
|
||||
@@ -264,8 +263,7 @@ RSpec.describe Spree::Admin::PaymentsController, type: :request do
|
||||
|
||||
context "with a VINE voucher", feature: :connected_apps do
|
||||
let(:vine_voucher) {
|
||||
create(:voucher_flat_rate, voucher_type: "VINE", code: 'some_code',
|
||||
enterprise: order.distributor, amount: 6)
|
||||
create(:vine_voucher, code: 'some_code', enterprise: order.distributor, amount: 6)
|
||||
}
|
||||
let(:vine_voucher_redeemer) { instance_double(Vine::VoucherRedeemerService) }
|
||||
|
||||
|
||||
@@ -11,9 +11,9 @@ RSpec.describe Vine::VoucherRedeemerService, feature: :connected_apps do
|
||||
let(:order) { create(:order_with_line_items, line_items_count: 1, distributor:, order_cycle:) }
|
||||
|
||||
let(:vine_voucher) {
|
||||
create(:voucher_flat_rate, voucher_type: "VINE", code: 'some_code', enterprise: distributor,
|
||||
amount: 6, external_voucher_id: voucher_id,
|
||||
external_voucher_set_id: voucher_set_id )
|
||||
create(:vine_voucher, code: 'some_code', enterprise: distributor,
|
||||
amount: 6, external_voucher_id: voucher_id,
|
||||
external_voucher_set_id: voucher_set_id )
|
||||
}
|
||||
let(:voucher_id) { "9d316d27-0dad-411a-8953-316a1aaf7742" }
|
||||
let(:voucher_set_id) { "9d314daa-0878-4b73-922d-698047640cf4" }
|
||||
|
||||
@@ -275,8 +275,7 @@ RSpec.describe Vine::VoucherValidatorService, feature: :connected_apps do
|
||||
)
|
||||
}
|
||||
let!(:voucher) {
|
||||
create(:voucher_flat_rate, enterprise: distributor, code: voucher_code,
|
||||
amount: 500, voucher_type: "VINE" )
|
||||
create(:vine_voucher, enterprise: distributor, code: voucher_code, amount: 500)
|
||||
}
|
||||
|
||||
let(:data) {
|
||||
|
||||
@@ -352,8 +352,7 @@ RSpec.describe "As a consumer, I want to checkout my order" do
|
||||
)
|
||||
}
|
||||
let(:vine_voucher) {
|
||||
create(:voucher_flat_rate, voucher_type: "VINE", code: 'some_vine_code',
|
||||
enterprise: distributor, amount: 0.01)
|
||||
create(:vine_voucher, code: 'some_vine_code', enterprise: distributor, amount: 0.01)
|
||||
}
|
||||
|
||||
before do
|
||||
|
||||
Reference in New Issue
Block a user