Fixing up a couple of regressions

This commit is contained in:
Will Marshall
2014-07-29 13:46:38 +10:00
parent 21cc5bc05a
commit 8496609cc2
4 changed files with 12 additions and 6 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -1,5 +1,6 @@
require 'spec_helper'
# TODO this seems to be redundant
describe Cart do
describe "associations" do

View File

@@ -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