Merge pull request #7641 from luisramos0/order_path

[Rails 6.1] Fix view specs
This commit is contained in:
Andy Brett
2021-05-24 14:41:32 -07:00
committed by GitHub
5 changed files with 6 additions and 12 deletions

View File

@@ -95,7 +95,7 @@ module Spree
@order.next_transition.run_callbacks if @order.cart?
redirect_to main_app.checkout_state_path(@order.checkout_steps.first)
elsif @order.complete?
redirect_to order_path(@order)
redirect_to main_app.order_path(@order)
else
redirect_to main_app.cart_path
end
@@ -135,7 +135,7 @@ module Spree
else
flash[:error] = I18n.t(:orders_could_not_cancel)
end
redirect_to request.referer || order_path(@order)
redirect_to request.referer || main_app.order_path(@order)
end
private
@@ -188,7 +188,7 @@ module Spree
if items.empty?
flash[:error] = I18n.t(:orders_cannot_remove_the_final_item)
redirect_to order_path(order_to_update)
redirect_to main_app.order_path(order_to_update)
end
end

View File

@@ -12,7 +12,7 @@
- if order.changes_allowed?
.columns.show-for-medium-up.medium-3  
.columns.small-12.medium-3
= link_to cancel_order_path(@order), method: :put, :class => "button secondary expand", "confirm-link-click" => t('orders_confirm_cancel') do
= link_to main_app.cancel_order_path(@order), method: :put, :class => "button secondary expand", "confirm-link-click" => t('orders_confirm_cancel') do
%i.ofn-i_009-close
= t(:cancel_order)
.columns.small-12.medium-3

View File

@@ -41,7 +41,7 @@
= t(:orders_changeable_orders_alert_html, oc_close: l(order.order_cycle.orders_close_at, format: "%b %d, %Y %H:%M"))
%a.close{ "ng-click" => "close()" } ×
= form_for order, url: order_path(order), html: {id: 'update-order', name: 'update_order_form' } do |order_form|
= form_for order, url: main_app.order_path(order), html: {id: 'update-order', name: 'update_order_form' } do |order_form|
- if order.changes_allowed?
= render 'spree/orders/form', order_form: order_form
-else

View File

@@ -255,10 +255,6 @@ describe Spree::OrdersController, type: :controller do
describe "the page" do
render_views
it "provides the right registration path" do
expect(subject.registration_path).to eq registration_path
end
it "shows the right registration link" do
# We fixed our view by hardcoding the link.
spree_registration_path = '/signup'

View File

@@ -8,9 +8,7 @@ describe "spree/admin/payment_methods/index.html.haml" do
helper Spree::Admin::BaseHelper
before do
controller.singleton_class.class_eval do
helper_method :new_object_url, :edit_object_url, :object_url
ActionView::Base.class_eval do
def new_object_url() "" end
def edit_object_url(_object, _options = {}) "" end