Sha256: 6948a378f2521159eef14d1ca9c00ba6e2cf8cac38ed182cf3f2dfdde213a3af
Contents?: true
Size: 952 Bytes
Versions: 6
Compression:
Stored size: 952 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
6 entries across 6 versions & 1 rubygems