From 7e62bfcdfb685d40a039dedd65f0d2363f9b2423 Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Sun, 30 Jan 2022 10:57:40 +0000 Subject: [PATCH] Add failing test for loading address with state correctly in split checkout --- spec/system/consumer/split_checkout_spec.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/spec/system/consumer/split_checkout_spec.rb b/spec/system/consumer/split_checkout_spec.rb index 91431f0134..eefca9e4a5 100644 --- a/spec/system/consumer/split_checkout_spec.rb +++ b/spec/system/consumer/split_checkout_spec.rb @@ -223,6 +223,25 @@ describe "As a consumer, I want to checkout my order", js: true do end end + context "with a saved address" do + let!(:address_state) do + create(:state, name: "Testville", abbr: "TST", country: DefaultCountry.country ) + end + let(:saved_address) do + create(:bill_address, state: address_state, zipcode: "TST01" ) + end + + before do + user.update_columns bill_address_id: saved_address.id + end + + xit "pre-fills address details" do + visit checkout_path + expect(page).to have_select "order_bill_address_attributes_state_id", selected: "Testville" + expect(page).to have_field "order_bill_address_attributes_zipcode", with: "TST01" + end + end + context "summary step" do let(:order) { create(:order_ready_for_confirmation, distributor: distributor) }