From ea5f9c67477b8e59bc393af331c8c6bd22264c04 Mon Sep 17 00:00:00 2001 From: Andy Brett Date: Fri, 9 Apr 2021 10:28:37 -0700 Subject: [PATCH] Revert "Fix cart_service_spec to adapt to the actual usage of it from cart_controller, params are now sent inside a Parameters object, not as a hash" This reverts commit bb465b5715cdad836d6cfea91e99be033afbb215. --- spec/services/cart_service_spec.rb | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/spec/services/cart_service_spec.rb b/spec/services/cart_service_spec.rb index 51e8f2b882..b8144f867b 100644 --- a/spec/services/cart_service_spec.rb +++ b/spec/services/cart_service_spec.rb @@ -27,8 +27,7 @@ describe CartService do describe "#populate" do it "adds a variant" do cart_service.populate( - ActionController::Parameters.new({ variants: { variant.id.to_s => { quantity: '1', - max_quantity: '2' } } }), + { variants: { variant.id.to_s => { quantity: '1', max_quantity: '2' } } }, true ) li = order.find_line_item_by_variant(variant) @@ -42,8 +41,7 @@ describe CartService do order.add_variant variant, 1, 2 cart_service.populate( - ActionController::Parameters.new({ variants: { variant.id.to_s => { quantity: '2', - max_quantity: '3' } } }), + { variants: { variant.id.to_s => { quantity: '2', max_quantity: '3' } } }, true ) li = order.find_line_item_by_variant(variant) @@ -56,7 +54,7 @@ describe CartService do it "removes a variant" do order.add_variant variant, 1, 2 - cart_service.populate(ActionController::Parameters.new({ variants: {} }), true) + cart_service.populate({ variants: {} }, true) order.line_items.reload li = order.find_line_item_by_variant(variant) expect(li).not_to be @@ -69,7 +67,7 @@ describe CartService do it "does not add the deleted variant to the cart" do variant.delete - cart_service.populate(ActionController::Parameters.new({ variants: { variant.id.to_s => { quantity: '2' } } }), true) + cart_service.populate({ variants: { variant.id.to_s => { quantity: '2' } } }, true) expect(relevant_line_item).to be_nil expect(cart_service.errors.count).to be 0 @@ -84,7 +82,7 @@ describe CartService do it "removes the line_item from the cart" do variant.delete - cart_service.populate(ActionController::Parameters.new({ variants: { variant.id.to_s => { quantity: '3' } } }), true) + cart_service.populate({ variants: { variant.id.to_s => { quantity: '3' } } }, true) expect(Spree::LineItem.where(id: relevant_line_item).first).to be_nil expect(cart_service.errors.count).to be 0