mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-30 06:31:16 +00:00
Reference splitcheckout as a checkout redirect
This stored in session value is used to redirect after login
Update tests as well, thanks @filipefurtad0 ! 🙏
This commit is contained in:
@@ -62,7 +62,9 @@ class ApplicationController < ActionController::Base
|
||||
end
|
||||
|
||||
def set_checkout_redirect
|
||||
return unless URI(request.referer.to_s).path == main_app.checkout_path
|
||||
referer_path = URI(request.referer.to_s).path
|
||||
return unless referer_path == main_app.checkout_path ||
|
||||
referer_path == main_app.checkout_step_path(:details)
|
||||
|
||||
session["spree_user_return_to"] = main_app.checkout_path
|
||||
end
|
||||
|
||||
@@ -16,6 +16,8 @@ class SplitCheckoutController < ::BaseController
|
||||
helper 'spree/orders'
|
||||
helper OrderHelper
|
||||
|
||||
before_action :set_checkout_redirect
|
||||
|
||||
def edit
|
||||
redirect_to_step unless params[:step]
|
||||
end
|
||||
|
||||
@@ -66,12 +66,8 @@ describe "As a consumer I want to check out my cart", js: true do
|
||||
end
|
||||
|
||||
context "and populating user details on (#{checkout_type})", if: checkout_type.eql?("split_checkout") do
|
||||
it "currently redirects to the homepage" do
|
||||
# currently redirects to the homepage due to bug #8894
|
||||
expect(page).to have_content("Logged in successfully")
|
||||
end
|
||||
it "should allow proceeding to the next step" do
|
||||
pending("bug fix for #8894")
|
||||
expect(page).to have_content("Logged in successfully")
|
||||
click_button "Next - Payment method"
|
||||
expect(page).to have_button("Next - Order summary")
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user