From 3f2b3b88eb7d494734a473e6eb7f65f36c95bc78 Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Mon, 5 Sep 2022 10:59:15 +1000 Subject: [PATCH] Re-use in-memory test objects And reduce code by referring to objects instead of just ids. --- .../consumer/split_checkout_tax_not_incl_spec.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/spec/system/consumer/split_checkout_tax_not_incl_spec.rb b/spec/system/consumer/split_checkout_tax_not_incl_spec.rb index 1d6188e585..fe1c970e1a 100644 --- a/spec/system/consumer/split_checkout_tax_not_incl_spec.rb +++ b/spec/system/consumer/split_checkout_tax_not_incl_spec.rb @@ -10,26 +10,26 @@ describe "As a consumer, I want to see adjustment breakdown" do include AuthenticationHelper include WebHelper - let!(:address_within_zone) { create(:address, state_id: Spree::State.first.id) } - let!(:address_outside_zone) { create(:address, state_id: Spree::State.second.id) } + let!(:address_within_zone) { create(:address, state: Spree::State.first) } + let!(:address_outside_zone) { create(:address, state: Spree::State.second) } let!(:user_within_zone) { - create(:user, bill_address_id: address_within_zone.id, - ship_address_id: address_within_zone.id) + create(:user, bill_address: address_within_zone, + ship_address: address_within_zone) } let!(:user_outside_zone) { - create(:user, bill_address_id: address_outside_zone.id, - ship_address_id: address_outside_zone.id) + create(:user, bill_address: address_outside_zone, + ship_address: address_outside_zone) } let!(:zone) { create(:zone_with_state_member, name: 'Victoria', default_tax: false) } let!(:tax_category) { create(:tax_category, name: "Veggies", is_default: "f") } let!(:tax_rate) { create(:tax_rate, name: "Tax rate - included or not", amount: 0.13, - zone_id: zone.id, tax_category_id: tax_category.id, included_in_price: false) + zone: zone, tax_category: tax_category, included_in_price: false) } let(:distributor) { create(:distributor_enterprise, charges_sales_tax: true) } let(:supplier) { create(:supplier_enterprise) } let!(:product_with_tax) { - create(:simple_product, supplier: supplier, price: 10, tax_category_id: tax_category.id) + create(:simple_product, supplier: supplier, price: 10, tax_category: tax_category) } let!(:variant_with_tax) { product_with_tax.variants.first } let!(:order_cycle) {