Skip to content

Commit aaa2411

Browse files
Rename manifest_for_order to shipping_manifest_for_order
This commit is going to rename the method `manifest_for_order` to `shipping_manifest_for_order` I also refactored it to use the memoized `shipping_manifest` method.
1 parent fb28cce commit aaa2411

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

core/app/models/spree/carton.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,13 @@ def shipping_manifest_items
5252
alias manifest shipping_manifest_items
5353
deprecate manifest: :shipping_manifest_items, deprecator: Spree::Deprecation
5454

55-
def manifest_for_order(order)
56-
Spree::ShippingManifest.new(inventory_units: inventory_units).for_order(order).items
55+
def shipping_manifest_for_order(order)
56+
shipping_manifest.for_order(order).items
5757
end
5858

59+
alias manifest_for_order shipping_manifest_for_order
60+
deprecate manifest_for_order: :shipping_manifest_for_order, deprecator: Spree::Deprecation
61+
5962
def any_exchanges?
6063
inventory_units.any?(&:original_return_item)
6164
end

core/spec/models/spree/carton_spec.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,15 @@
106106
end
107107

108108
describe "#manifest_for_order" do
109+
it "is deprecated" do
110+
Spree::Deprecation.silence do
111+
expect(Spree::Deprecation).to(receive(:warn))
112+
Spree::Carton.new.manifest_for_order(create(:order))
113+
end
114+
end
115+
end
116+
117+
describe "#shipping_manifest_for_order" do
109118
subject { carton.manifest_for_order(first_order) }
110119

111120
let(:carton) { create(:carton, inventory_units: [first_order.inventory_units, second_order.inventory_units].flatten) }

0 commit comments

Comments
 (0)