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:
Jean-Baptiste Bellet
2022-02-17 14:41:12 +01:00
parent 3e85762143
commit f47de45346
3 changed files with 6 additions and 6 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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