Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not refresh shipping rates everytime the order is viewed in the admin #1798

Merged
merged 1 commit into from
Jun 28, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions backend/app/controllers/spree/admin/orders_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,9 @@ def new

def edit
require_ship_address

unless @order.completed?
@order.refresh_shipment_rates
end
end

def cart
unless @order.completed?
@order.refresh_shipment_rates
end
if @order.shipped_shipments.count > 0
redirect_to edit_admin_order_url(@order)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,17 @@
end

# Regression test for https://github.com/spree/spree/issues/3684
# Rendering a form should under no circumstance mutate the order
context "#edit" do
it "does not refresh rates if the order is completed" do
allow(order).to receive_messages completed?: true
expect(order).not_to receive :refresh_shipment_rates
get :edit, params: { id: order.number }
end

it "does refresh the rates if the order is incomplete" do
it "does not refresh the rates if the order is incomplete" do
allow(order).to receive_messages completed?: false
expect(order).to receive :refresh_shipment_rates
expect(order).not_to receive :refresh_shipment_rates
get :edit, params: { id: order.number }
end

Expand Down