Skip to content

Commit

Permalink
Turns out we probably want to redirect to an empty cart if the order …
Browse files Browse the repository at this point in the history
…is complete.
  • Loading branch information
schof committed Aug 18, 2010
1 parent 6f8b6dc commit 659f303
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
1 change: 0 additions & 1 deletion core/app/controllers/checkout_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ def object_params
def load_order
@order = current_order
redirect_to cart_path and return if @order.nil? or @order.empty?
redirect_to order_path(@order) if @order.complete?
@order.state = params[:state] if params[:state]
state_callback(:before)
end
Expand Down
7 changes: 3 additions & 4 deletions core/spec/controllers/checkout_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,15 @@
end

context "when order is complete" do
before(:each) { order.stub(:complete?).and_return true }

before { controller.stub! :current_order => nil }
it "should not change the state if order is completed" do
order.should_not_receive(:update_attribute)
post :update, {:state => "confirm"}
end

it "should redirect to the order_path" do
it "should redirect to the cart_path" do
post :update, {:state => "confirm"}
response.should redirect_to order_path(assigns[:order])
response.should redirect_to cart_path
end
end

Expand Down

0 comments on commit 659f303

Please sign in to comment.