Sha256: 8f3cd63e45518c0742703ded4bd5d5fd25f827b3a3be18b8259a4a161bc5b6ed

Contents?: true

Size: 967 Bytes

Versions: 34

Compression:

Stored size: 967 Bytes

Contents

require 'spec_helper'

Spree::Order.class_eval do
  attr_accessor :did_transition
end

module Spree
  describe OrdersController, :type => :controller do
    # Regression test for #2004
    context "with a transition callback on first state" do
      let(:order) { Spree::Order.new }

      before do
        allow(controller).to receive_messages :current_order => order
        expect(controller).to receive(:authorize!).at_least(:once).and_return(true)

        first_state, _ = Spree::Order.checkout_steps.first
        Spree::Order.state_machine.after_transition :to => first_state do |order|
          order.did_transition = true
        end
      end

      it "correctly calls the transition callback" do
        expect(order.did_transition).to be_nil
        order.line_items << FactoryGirl.create(:line_item)
        spree_put :update, { :checkout => "checkout" }, { :order_id => 1}
        expect(order.did_transition).to be true
      end
    end
  end
end

Version data entries

34 entries across 34 versions & 2 rubygems

Version Path
solidus_frontend-1.1.4 spec/controllers/spree/orders_controller_transitions_spec.rb
solidus_frontend-1.0.7 spec/controllers/spree/orders_controller_transitions_spec.rb
spree_frontend-3.1.5 spec/controllers/spree/orders_controller_transitions_spec.rb
spree_frontend-3.1.4 spec/controllers/spree/orders_controller_transitions_spec.rb
spree_frontend-3.1.3 spec/controllers/spree/orders_controller_transitions_spec.rb
spree_frontend-3.1.2 spec/controllers/spree/orders_controller_transitions_spec.rb
spree_frontend-3.0.10 spec/controllers/spree/orders_controller_transitions_spec.rb
spree_frontend-3.1.1 spec/controllers/spree/orders_controller_transitions_spec.rb
spree_frontend-3.1.0 spec/controllers/spree/orders_controller_transitions_spec.rb
spree_frontend-3.1.0.rc4 spec/controllers/spree/orders_controller_transitions_spec.rb
spree_frontend-3.0.9 spec/controllers/spree/orders_controller_transitions_spec.rb
spree_frontend-3.1.0.rc3 spec/controllers/spree/orders_controller_transitions_spec.rb
spree_frontend-3.1.0.rc2 spec/controllers/spree/orders_controller_transitions_spec.rb
spree_frontend-3.1.0.rc1 spec/controllers/spree/orders_controller_transitions_spec.rb
solidus_frontend-1.0.6 spec/controllers/spree/orders_controller_transitions_spec.rb
spree_frontend-3.0.8 spec/controllers/spree/orders_controller_transitions_spec.rb
spree_frontend-3.0.7 spec/controllers/spree/orders_controller_transitions_spec.rb
solidus_frontend-1.1.3 spec/controllers/spree/orders_controller_transitions_spec.rb
solidus_frontend-1.0.5 spec/controllers/spree/orders_controller_transitions_spec.rb
spree_frontend-3.0.6.1 spec/controllers/spree/orders_controller_transitions_spec.rb