diff --git a/app/models/spree/order_populator_decorator.rb b/app/models/spree/order_populator_decorator.rb index 32d6afe12d..e9e3f0d0ed 100644 --- a/app/models/spree/order_populator_decorator.rb +++ b/app/models/spree/order_populator_decorator.rb @@ -76,7 +76,7 @@ Spree::OrderPopulator.class_eval do end def variants_removed(variants_data) - variant_ids_given = variants_data.map { |data| data[:variant_id] } + variant_ids_given = variants_data.map { |data| data[:variant_id].to_i } (variant_ids_in_cart - variant_ids_given).uniq end diff --git a/spec/models/spree/order_populator_spec.rb b/spec/models/spree/order_populator_spec.rb index 1e6e06677d..2ea77b5b5c 100644 --- a/spec/models/spree/order_populator_spec.rb +++ b/spec/models/spree/order_populator_spec.rb @@ -100,12 +100,12 @@ module Spree it "returns nothing when all items in the cart are provided" do op.stub(:variant_ids_in_cart) { [123] } - op.send(:variants_removed, [{variant_id: 123}]).should == [] + op.send(:variants_removed, [{variant_id: '123'}]).should == [] end it "returns nothing when items are added to cart" do op.stub(:variant_ids_in_cart) { [123] } - op.send(:variants_removed, [{variant_id: 123}, {variant_id: 456}]).should == [] + op.send(:variants_removed, [{variant_id: '123'}, {variant_id: '456'}]).should == [] end it "does not return duplicates" do