From 40c986892e8235a6906b367f5e35928b429428a6 Mon Sep 17 00:00:00 2001 From: Will Marshall Date: Fri, 7 Mar 2014 15:18:26 +1100 Subject: [PATCH] Patching the paypal test --- app/controllers/shop/checkout_controller.rb | 5 ++--- spec/controllers/shop/checkout_controller_spec.rb | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/shop/checkout_controller.rb b/app/controllers/shop/checkout_controller.rb index f9e416c677..6fd69a4d17 100644 --- a/app/controllers/shop/checkout_controller.rb +++ b/app/controllers/shop/checkout_controller.rb @@ -14,8 +14,6 @@ class Shop::CheckoutController < Spree::CheckoutController def update if @order.update_attributes(params[:order]) fire_event('spree.checkout.update') - - while @order.state != "complete" if @order.state == "payment" return if redirect_to_paypal_express_form_if_needed @@ -106,7 +104,8 @@ class Shop::CheckoutController < Spree::CheckoutController true end - + + # Overriding to customize the cancel url def order_opts_with_new_cancel_return_url(order, payment_method_id, stage) opts = order_opts_without_new_cancel_return_url(order, payment_method_id, stage) opts[:cancel_return_url] = main_app.shop_checkout_url diff --git a/spec/controllers/shop/checkout_controller_spec.rb b/spec/controllers/shop/checkout_controller_spec.rb index dac804ea6c..c27bc2bfd9 100644 --- a/spec/controllers/shop/checkout_controller_spec.rb +++ b/spec/controllers/shop/checkout_controller_spec.rb @@ -60,6 +60,7 @@ describe Shop::CheckoutController do it "should check the payment method for Paypalness if we've selected one" do Spree::PaymentMethod.should_receive(:find).with(payment_method.id.to_s).and_return payment_method order.stub(:update_attributes).and_return true + order.stub(:state).and_return "payment" spree_post :update, order: {payments_attributes: [{payment_method_id: payment_method.id}]} end