Sha256: 311e969e6f1fad8f46d21e18422d153b0b57fc8a2882dc00b7fb9f3930511a71

Contents?: true

Size: 909 Bytes

Versions: 3

Compression:

Stored size: 909 Bytes

Contents

require 'spec/spec_helper'

describe Shop::OrdersController do
  
  dataset :shop_orders
  
  before(:each) do
    @order = shop_orders(:one_item)
  end
  
  describe '#finalize' do
    context 'paid order' do
      it 'should redirect to the thanks page' do
        stub(@order).new? { false }
        mock(controller).current_shop_order { @order }
        
        get :finalize
        
        response.should redirect_to("/#{Radiant::Config['shop.cart_thanks_path']}")
      end
      it 'should set the session shop_order to nil'
    end
    
    context 'new order' do
      it 'should redirect to the cart page' do
        stub(@order).new? { true }
        mock(controller).current_shop_order { @order }
        
        get :finalize
        
        response.should redirect_to("/#{Radiant::Config['shop.cart_path']}")
      end
      it 'should not touch the session shop_order'
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
radiant-shop-extension-0.10.0 spec/controllers/shop/orders_controller_specs.rb
radiant-shop-extension-0.9.3 spec/controllers/shop/orders_controller_specs.rb
radiant-shop-extension-0.9.2 spec/controllers/shop/orders_controller_specs.rb