mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-04-07 07:36:58 +00:00
Address review feedback: use referer in specs, remove demo screenshots
- Set HTTP_REFERER in cancel action specs so they test the redirect to the actual order page (not the cancel path, which was the implicit referer in controller specs) - Keep response.body match pattern (consistent with checkout_controller_spec for CableReady redirects — redirect_to matcher does not work here since the cancel action uses cable_car.redirect_to, not a Rails redirect) - Remove doc/demo screenshots; images to be added to PR description instead Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 80 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 79 KiB |
@@ -473,9 +473,9 @@ RSpec.describe Spree::OrdersController do
|
||||
end
|
||||
|
||||
it "cancels the order and redirects to the order page" do
|
||||
request.env['HTTP_REFERER'] = order_path(order)
|
||||
spree_put :cancel, params
|
||||
|
||||
expect(response).to have_http_status(:found)
|
||||
expect(response.body).to match(order_path(order)).and match("redirect")
|
||||
expect(flash[:success]).to eq 'Your order has been cancelled'
|
||||
end
|
||||
@@ -486,9 +486,9 @@ RSpec.describe Spree::OrdersController do
|
||||
|
||||
context "when the order is not yet complete" do
|
||||
it "responds with forbidden" do
|
||||
request.env['HTTP_REFERER'] = order_path(order)
|
||||
spree_put :cancel, params
|
||||
|
||||
expect(response).to have_http_status(:found)
|
||||
expect(response.body).to match(order_path(order)).and match("redirect")
|
||||
expect(flash[:error]).to eq 'Sorry, the order could not be cancelled'
|
||||
end
|
||||
@@ -501,9 +501,9 @@ RSpec.describe Spree::OrdersController do
|
||||
}
|
||||
|
||||
it "responds with success" do
|
||||
request.env['HTTP_REFERER'] = order_path(order)
|
||||
spree_put :cancel, params
|
||||
|
||||
expect(response).to have_http_status(:found)
|
||||
expect(response.body).to match(order_path(order)).and match("redirect")
|
||||
expect(flash[:success]).to eq 'Your order has been cancelled'
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user