diff --git a/app/models/spree/order_populator_decorator.rb b/app/models/spree/order_populator_decorator.rb index 4bc1cdf610..e281755fdc 100644 --- a/app/models/spree/order_populator_decorator.rb +++ b/app/models/spree/order_populator_decorator.rb @@ -15,8 +15,12 @@ Spree::OrderPopulator.class_eval do attempt_cart_add(variant_id, from_hash[:quantity]) end if from_hash[:products] - from_hash[:variants].each do |variant_id, args| - attempt_cart_add(variant_id, args[:quantity], args[:max_quantity]) + from_hash[:variants].each do |variant_id, quantity| + if quantity.is_a?(Hash) + attempt_cart_add(variant_id, quantity[:quantity], quantity[:max_quantity]) + else + attempt_cart_add(variant_id, quantity) + end end if from_hash[:variants] end end diff --git a/spec/controllers/shop_controller_spec.rb b/spec/controllers/shop_controller_spec.rb index 23b97e93a0..f1c132bb24 100644 --- a/spec/controllers/shop_controller_spec.rb +++ b/spec/controllers/shop_controller_spec.rb @@ -114,7 +114,8 @@ describe ShopController do it "scopes variants for a product to the order cycle and distributor" do controller.stub(:current_order_cycle).and_return order_cycle controller.stub(:current_distributor).and_return d - Spree::Product.any_instance.should_receive(:variants_for).with(order_cycle, d) + Spree::Product.any_instance.should_receive(:variants_for).with(order_cycle, d).and_return(m = double()) + m.stub(:in_stock).and_return [] xhr :get, :products end diff --git a/spec/models/cart_spec.rb b/spec/models/cart_spec.rb index d45aee1098..8fb39b9d60 100644 --- a/spec/models/cart_spec.rb +++ b/spec/models/cart_spec.rb @@ -1,5 +1,6 @@ require 'spec_helper' +# TODO this seems to be redundant describe Cart do describe "associations" do diff --git a/spec/models/enterprise_spec.rb b/spec/models/enterprise_spec.rb index 3837bd23ee..c517a3ed41 100644 --- a/spec/models/enterprise_spec.rb +++ b/spec/models/enterprise_spec.rb @@ -448,9 +448,9 @@ describe Enterprise do linkedin: "https://linkedin.com") } - it "strips http and www from url fields" do - distributor.website.should == "google.com" - distributor.facebook.should == "facebook.com/roger" + it "strips http from url fields" do + distributor.website.should == "www.google.com" + distributor.facebook.should == "www.facebook.com/roger" distributor.linkedin.should == "linkedin.com" end end