diff --git a/spec/controllers/checkout_controller_spec.rb b/spec/controllers/checkout_controller_spec.rb index c83f8007ef..b59898b278 100644 --- a/spec/controllers/checkout_controller_spec.rb +++ b/spec/controllers/checkout_controller_spec.rb @@ -40,8 +40,8 @@ describe CheckoutController, type: :controller do let(:order_cycle_distributed_variants) { double(:order_cycle_distributed_variants) } before do - controller.stub(:current_order).and_return(order) - order.stub(:distributor).and_return(distributor) + allow(controller).to receive(:current_order).and_return(order) + allow(order).to receive(:distributor).and_return(distributor) order.order_cycle = order_cycle allow(OrderCycleDistributedVariants).to receive(:new).with(order_cycle, distributor).and_return(order_cycle_distributed_variants) @@ -62,7 +62,6 @@ describe CheckoutController, type: :controller do expect(response).to redirect_to spree.cart_path end - it "does not redirect when items are available and in stock" do allow(order).to receive_message_chain(:insufficient_stock_lines, :empty?).and_return true expect(order_cycle_distributed_variants).to receive(:distributes_order_variants?).with(order).and_return(true) diff --git a/spec/services/order_cycle_distributed_variants_spec.rb b/spec/services/order_cycle_distributed_variants_spec.rb index fd55e1ada5..8b92e7905b 100644 --- a/spec/services/order_cycle_distributed_variants_spec.rb +++ b/spec/services/order_cycle_distributed_variants_spec.rb @@ -9,14 +9,14 @@ describe OrderCycleDistributedVariants do describe "checking if an order can change to a specified new distribution" do it "returns false when a variant is not available for the specified distribution" do - order.should_receive(:line_item_variants) { [1] } - subject.should_receive(:available_variants) { [] } + allow(order).to receive(:line_item_variants).and_return([1]) + allow(subject).to receive(:available_variants).and_return([]) expect(subject.distributes_order_variants?(order)).to be false end it "returns true when all variants are available for the specified distribution" do - order.should_receive(:line_item_variants) { [1] } - subject.should_receive(:available_variants) { [1] } + allow(order).to receive(:line_item_variants).and_return([1]) + allow(subject).to receive(:available_variants).and_return([1]) expect(subject.distributes_order_variants?(order)).to be true end end @@ -24,7 +24,7 @@ describe OrderCycleDistributedVariants do describe "finding variants that are available through a particular order cycle" do it "finds variants distributed by order cycle" do variant = double(:variant) - order_cycle.should_receive(:variants_distributed_by).with(distributor) { [variant] } + allow(order_cycle).to receive(:variants_distributed_by).with(distributor).and_return([variant]) expect(subject.available_variants).to eq [variant] end