mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-30 21:27:17 +00:00
Update SalesTax test setup
This commit is contained in:
@@ -186,7 +186,7 @@ feature '
|
||||
let(:shipping_tax_category) { create(:tax_category, tax_rates: [shipping_tax_rate]) }
|
||||
let!(:shipping_method) { create(:shipping_method_with, :expensive_name, distributors: [distributor1], tax_category: shipping_tax_category) }
|
||||
let(:enterprise_fee) { create(:enterprise_fee, enterprise: user1.enterprises.first, tax_category: product2.tax_category, calculator: Calculator::FlatRate.new(preferred_amount: 120.0)) }
|
||||
let(:order_cycle) { create(:simple_order_cycle, coordinator: distributor1, coordinator_fees: [enterprise_fee], distributors: [distributor1], variants: [product1.master]) }
|
||||
let(:order_cycle) { create(:simple_order_cycle, coordinator: distributor1, coordinator_fees: [enterprise_fee], distributors: [distributor1], variants: [product1.variants.first, product2.variants.first]) }
|
||||
|
||||
let!(:zone) { create(:zone_with_member) }
|
||||
let(:address) { create(:address) }
|
||||
@@ -194,20 +194,20 @@ feature '
|
||||
let(:product1) { create(:taxed_product, zone: zone, price: 12.54, tax_rate_amount: 0) }
|
||||
let(:product2) { create(:taxed_product, zone: zone, price: 500.15, tax_rate_amount: 0.2) }
|
||||
|
||||
let!(:line_item1) { create(:line_item, variant: product1.master, price: 12.54, quantity: 1, order: order1) }
|
||||
let!(:line_item2) { create(:line_item, variant: product2.master, price: 500.15, quantity: 3, order: order1) }
|
||||
let!(:line_item1) { create(:line_item, variant: product1.variants.first, price: 12.54, quantity: 1, order: order1) }
|
||||
let!(:line_item2) { create(:line_item, variant: product2.variants.first, price: 500.15, quantity: 3, order: order1) }
|
||||
|
||||
before do
|
||||
order1.reload
|
||||
2.times { order1.next }
|
||||
order1.select_shipping_method shipping_method.id
|
||||
order1.reload.recreate_all_fees!
|
||||
order1.create_tax_charge!
|
||||
order1.update_order!
|
||||
order1.finalize!
|
||||
break unless order1.next! until order1.delivery?
|
||||
order1.select_shipping_method(shipping_method.id)
|
||||
order1.recreate_all_fees!
|
||||
break unless order1.next! until order1.payment?
|
||||
create(:payment, state: "checkout", order: order1, amount: order1.reload.total,
|
||||
payment_method: create(:payment_method, distributors: [distributor1]))
|
||||
break unless order1.next! until order1.complete?
|
||||
|
||||
login_as_admin_and_visit spree.admin_reports_path
|
||||
|
||||
click_link "Sales Tax"
|
||||
select("Tax types", from: "report_type")
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user