mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-28 01:53:25 +00:00
Fixing up a couple of regressions
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
require 'spec_helper'
|
||||
|
||||
# TODO this seems to be redundant
|
||||
describe Cart do
|
||||
|
||||
describe "associations" do
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user