Sha256: c89461981802941d52bfe203ef6b1a4c63d6ef466030918d6e30f88e983157ff

Contents?: true

Size: 1.27 KB

Versions: 4

Compression:

Stored size: 1.27 KB

Contents

require 'spec_helper'

describe Spree::OrdersController do

  let(:order) {double(Spree::Order).as_null_object}
  let(:recurring_order) {double(Spree::RecurringOrder)}
  let(:user) { mock_model Spree::User, :last_incomplete_spree_order => nil, :has_spree_role? => true, :spree_api_key => 'fake' }

  before :each do
    controller.stub :spree_current_user => user
    controller.stub :check_authorization
  end

  describe 'show' do

    before :each do
      Spree::Order.stub(:find_by_number!).with("G2134").and_return(order)
      Spree::RecurringOrder.stub(:new).and_return(recurring_order)
    end

    it 'should assign order' do
      spree_get :show, id: "G2134"
      assigns(:order).should == order
    end

    it 'should assign recurring order' do
      spree_get :show, id: "G2134"
      assigns(:recurring_order).should == recurring_order
    end

    it 'should render show_recurring if order completed is true' do
      spree_get :show, {id: "G2134", order_completed: true}
      assigns(:present_recurring).should == true 
      response.should render_template('show_recurring')
    end

    it 'should render show normally' do
      spree_get :show, {id: "G2134"}
      assigns(:present_recurring).should == false
      response.should render_template('show')
    end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
spree_recurring_order-2.1.9 spec/controllers/spree/orders_controller_spec.rb
spree_recurring_order-2.1.8 spec/controllers/spree/orders_controller_spec.rb
spree_recurring_order-2.1.7 spec/controllers/spree/orders_controller_spec.rb
spree_recurring_order-2.1.6 spec/controllers/spree/orders_controller_spec.rb