From fff5927cdfff7012b04c56ec733fcfe2bd5c0b6b Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Wed, 10 Aug 2022 14:09:42 +0100 Subject: [PATCH] Changes pick-up into delivery shipping method On line 62 we set the dependency on the shipping address to calculate taxes. Therefore, we might be better off mocking a delivery-shipping method instead of a pick-up shipping method and assuring the customers shipping address is used for this accordingly. --- .../split_checkout_tax_not_incl_spec.rb | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 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 7f3442af09..deb06d718d 100644 --- a/spec/system/consumer/split_checkout_tax_not_incl_spec.rb +++ b/spec/system/consumer/split_checkout_tax_not_incl_spec.rb @@ -37,8 +37,8 @@ describe "As a consumer, I want to see adjustment breakdown" do coordinator: distributor, variants: [variant_with_tax]) } let!(:free_shipping) { - create(:shipping_method, distributors: [distributor], require_ship_address: false, - name: "Pick-up", description: "Payment without fee", + create(:shipping_method, distributors: [distributor], require_ship_address: true, + name: "Delivery", description: "Payment without fee", calculator: Calculator::FlatRate.new(preferred_amount: 0.00)) } let!(:free_payment) { @@ -107,14 +107,13 @@ describe "As a consumer, I want to see adjustment breakdown" do end click_on "Place order now" - + # DB checks assert_db_tax # UI checks expect(page).to have_selector('#order_total', text: with_currency(11.30)) expect(page).to have_selector('#tax-row', text: with_currency(1.30)) - end after { logout } @@ -132,12 +131,12 @@ describe "As a consumer, I want to see adjustment breakdown" do it "will be charged tax on the order" do visit checkout_step_path(:details) - choose "Pick-up" + choose "Delivery" click_button "Next - Payment method" click_on "Next - Order summary" click_on "Complete order" - + # DB checks assert_db_tax @@ -145,7 +144,6 @@ describe "As a consumer, I want to see adjustment breakdown" do expect(page).to have_content("Confirmed") expect(page).to have_selector('#order_total', text: with_currency(11.30)) expect(page).to have_selector('#tax-row', text: with_currency(1.30)) - end end end @@ -193,7 +191,7 @@ describe "As a consumer, I want to see adjustment breakdown" do it "will not be charged tax on the order" do visit checkout_step_path(:details) - choose "Pick-up" + choose "Delivery" click_button "Next - Payment method" click_on "Next - Order summary" @@ -212,7 +210,7 @@ describe "As a consumer, I want to see adjustment breakdown" do context "changing the address on the /details step" do before do visit checkout_step_path(:details) - choose "Pick-up" + choose "Delivery" click_button "Next - Payment method" click_on "Next - Order summary" @@ -230,14 +228,13 @@ describe "As a consumer, I want to see adjustment breakdown" do # it should not be necessary to save as new default bill address check "order_save_bill_address" + check "ship_address_same_as_billing" - choose "Pick-up" + choose "Delivery" click_button "Next - Payment method" click_on "Next - Order summary" - # bill address should have state Victoria - # Summary step should reflect changes expect(page).to have_selector('#order_total', text: with_currency(11.30)) expect(page).to have_selector('#tax-row', text: with_currency(1.30))