Add specs for updating existing default addresses during checkout

These specs fail with the "NULL values for created_at / updated_at" errors we've been seeing.
This commit is contained in:
Matt-Yorkley
2020-06-30 11:21:29 +02:00
parent 57ba2481c4
commit abe96c6f32

View File

@@ -74,7 +74,7 @@ feature "As a consumer I want to check out my cart", js: true do
fill_out_form
end
it "allows user to save default billing address and shipping address" do
it "creates a new default billing address and shipping address" do
expect(user.bill_address).to be_nil
expect(user.ship_address).to be_nil
@@ -94,6 +94,32 @@ feature "As a consumer I want to check out my cart", js: true do
expect(user.reload.ship_address.address1).to eq '123 Your Head'
end
context "when the user and customer have existing default addresses" do
let(:existing_address) { create(:address) }
before do
user.bill_address = existing_address
user.ship_address = existing_address
end
xit "updates billing address and shipping address" do
expect(order.bill_address).to be_nil
expect(order.ship_address).to be_nil
place_order
expect(page).to have_content "Your order has been processed successfully"
expect(order.reload.bill_address.address1).to eq '123 Your Head'
expect(order.reload.ship_address.address1).to eq '123 Your Head'
expect(order.customer.bill_address.address1).to eq '123 Your Head'
expect(order.customer.ship_address.address1).to eq '123 Your Head'
expect(user.reload.bill_address.address1).to eq '123 Your Head'
expect(user.reload.ship_address.address1).to eq '123 Your Head'
end
end
it "it doesn't tell about previous orders" do
expect(page).to have_no_content("You have an order for this order cycle already.")
end