Skip to content

Commit

Permalink
Simplify test set up
Browse files Browse the repository at this point in the history
  • Loading branch information
rioug committed Sep 22, 2023
1 parent 71f7581 commit 870da88
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions spec/lib/reports/sales_tax_totals_by_order_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,20 @@
create(:ship_address, state: state_zone.members.first.zoneable,
country: country_zone.members.first.zoneable)
end
let(:variant) { create(:variant) }
let(:variant) { create(:variant, tax_category: ) }
let(:product) { variant.product }
let(:supplier) do
create(:supplier_enterprise, name: 'SupplierEnterprise', charges_sales_tax: true)
end
let(:distributor) do
create(:distributor_enterprise_with_tax, name: 'DistributorEnterpriseWithTax',
charges_sales_tax: true)
create(
:distributor_enterprise_with_tax,
name: 'DistributorEnterpriseWithTax',
charges_sales_tax: true
).tap do |distributor|
distributor.shipping_methods << shipping_method
distributor.payment_methods << payment_method
end
end
let(:payment_method) { create(:payment_method, :flat_rate) }
let(:shipping_method) do
Expand All @@ -43,11 +49,7 @@
end

before do
distributor.shipping_methods << shipping_method
distributor.payment_methods << payment_method

product.update!(supplier_id: supplier.id)
variant.update!(tax_category_id: tax_category.id)

order.update!(
number: 'ORDER_NUMBER_1',
Expand All @@ -71,8 +73,6 @@
]
end

# TODO see if we can simplify setup
# sould be able to only create the adjustment we need, or maybe mock them ?
it "returns tax amount filtered by tax rate in query_row" do
OrderWorkflow.new(order).complete!
mock_voucher_adjustment_service
Expand Down

0 comments on commit 870da88

Please sign in to comment.