From 2ef76d83726d052a380b6dfd50fe6f3d193cbf1d Mon Sep 17 00:00:00 2001 From: Daniele Palombo Date: Fri, 13 Nov 2020 19:18:23 +0100 Subject: [PATCH] Remove deprecated methods Spree::Shipment#transfer_to_location and Spree::Shipment#transfer_to_shipment https://github.com/solidusio/solidus/pull/2070/files --- core/app/models/spree/shipment.rb | 16 ---------------- core/spec/models/spree/shipment_spec.rb | 25 ------------------------- 2 files changed, 41 deletions(-) diff --git a/core/app/models/spree/shipment.rb b/core/app/models/spree/shipment.rb index 74bd764ad3d..8717bf58ed1 100644 --- a/core/app/models/spree/shipment.rb +++ b/core/app/models/spree/shipment.rb @@ -305,22 +305,6 @@ def update_state end end - def transfer_to_location(variant, quantity, stock_location) - Spree::Deprecation.warn("Please use the Spree::FulfilmentChanger class instead of Spree::Shipment#transfer_to_location", caller) - new_shipment = order.shipments.create!(stock_location: stock_location) - transfer_to_shipment(variant, quantity, new_shipment) - end - - def transfer_to_shipment(variant, quantity, shipment_to_transfer_to) - Spree::Deprecation.warn("Please use the Spree::FulfilmentChanger class instead of Spree::Shipment#transfer_to_location", caller) - Spree::FulfilmentChanger.new( - current_shipment: self, - desired_shipment: shipment_to_transfer_to, - variant: variant, - quantity: quantity - ).run! - end - def requires_shipment? !stock_location || stock_location.fulfillable? end diff --git a/core/spec/models/spree/shipment_spec.rb b/core/spec/models/spree/shipment_spec.rb index 87caf18be6f..4d269ed3b7d 100644 --- a/core/spec/models/spree/shipment_spec.rb +++ b/core/spec/models/spree/shipment_spec.rb @@ -26,31 +26,6 @@ let(:variant) { mock_model(Spree::Variant) } let(:line_item) { mock_model(Spree::LineItem, variant: variant) } - context '#transfer_to_location' do - before do - allow(Spree::Deprecation).to receive(:warn). - with(/^Please use the Spree::FulfilmentChanger class instead of Spree::Shipment#transfer_to_location/, any_args) - end - - it 'transfers unit to a new shipment with given location' do - order = create(:completed_order_with_totals, line_items_count: 2) - shipment = order.shipments.first - variant = order.inventory_units.map(&:variant).first - - aggregate_failures("verifying new shipment attributes") do - expect do - shipment.transfer_to_location(variant, 1, stock_location) - end.to change { Spree::Shipment.count }.by(1) - - new_shipment = order.shipments.order(:created_at).last - expect(new_shipment.number).to_not eq(shipment.number) - expect(new_shipment.stock_location).to eq(stock_location) - expect(new_shipment.line_items.count).to eq(1) - expect(new_shipment.line_items.first.variant).to eq(variant) - end - end - end - # Regression test for https://github.com/spree/spree/issues/4063 context "number generation" do it "generates a number containing a letter + 11 numbers" do