From 3724a67d16aec96c796394abf2ddc211aa671888 Mon Sep 17 00:00:00 2001 From: Rohan Mitchell Date: Wed, 5 Jun 2013 15:04:42 +1000 Subject: [PATCH] Add spec for OrderPopulator#set_cart_distributor_and_order_cycle --- spec/models/order_populator_spec.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/spec/models/order_populator_spec.rb b/spec/models/order_populator_spec.rb index 2be0741ac3..3380e6204e 100644 --- a/spec/models/order_populator_spec.rb +++ b/spec/models/order_populator_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' module Spree describe OrderPopulator do - let(:order) { double(:order) } + let(:order) { double(:order, id: 123) } let(:currency) { double(:currency) } let(:params) { double(:params) } let(:distributor) { double(:distributor) } @@ -90,7 +90,13 @@ module Spree end end - it "sets cart distributor and order cycle" + it "sets cart distributor and order cycle" do + Spree::Order.should_receive(:find).with(order.id).and_return(order) + order.should_receive(:set_distributor!).with(distributor) + order.should_receive(:set_order_cycle!).with(order_cycle) + + op.send(:set_cart_distributor_and_order_cycle, distributor, order_cycle) + end end describe "validations" do