Fix order_path issue in cart page

The order_path route wasn't being inferred correctly from this Spree controller, causing errors to be thrown in the cart page if the number of editable orders was precisely one:

ActionView::Template::Error: undefined method `order_path'
This commit is contained in:
Matt-Yorkley
2021-09-15 10:54:59 +01:00
parent 2f5f2a03dd
commit 0c879dc4c9
2 changed files with 11 additions and 1 deletions

View File

@@ -30,7 +30,7 @@ module Spree
end
def changeable_orders_link_path
changeable_orders.one? ? order_path(changeable_orders.first) : spree.account_path
changeable_orders.one? ? main_app.order_path(changeable_orders.first) : spree.account_path
end
def shop_changeable_orders_alert_html

View File

@@ -315,6 +315,16 @@ feature "full-page cart", js: true do
expect(page).to have_no_content item1.variant.name
expect(page).to have_content item2.variant.name
end
context "with a single editable order" do # Regression test for #8191
before do
prev_order2.destroy
end
it "doesn't throw an error" do
expect{ visit main_app.cart_path }.to_not raise_error
end
end
end
end
end