From e90077bb097e760b723f67a705a8484abaeb3f5d Mon Sep 17 00:00:00 2001 From: Rohan Mitchell Date: Wed, 5 Jun 2013 15:54:45 +1000 Subject: [PATCH] Add spec for OrderPopulator#order_cycle_required_for --- spec/models/order_populator_spec.rb | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/spec/models/order_populator_spec.rb b/spec/models/order_populator_spec.rb index d9e4e483bf..24d67086bb 100644 --- a/spec/models/order_populator_spec.rb +++ b/spec/models/order_populator_spec.rb @@ -124,6 +124,21 @@ module Spree op.send(:distribution_provided_for, variant).should be_true end end + + describe "checking if order cycle is required for a variant" do + it "requires an order cycle when the product has no product distributions" do + product = double(:product, product_distributions: []) + variant = double(:variant, product: product) + op.send(:order_cycle_required_for, variant).should be_true + end + + it "does not require an order cycle when the product has product distributions" do + product = double(:product, product_distributions: [1]) + variant = double(:variant, product: product) + op.send(:order_cycle_required_for, variant).should be_false + end + end + end describe "validations" do @@ -176,9 +191,6 @@ module Spree describe "checking variant is available under the distributor" do end - - describe "order cycle required for variant" do - end end end end