Merge pull request #7030 from Matt-Yorkley/dcotw-item-count

DCOTW: Order#item_count
This commit is contained in:
Pau Pérez Fabregat
2021-03-08 15:23:09 +01:00
committed by GitHub
2 changed files with 0 additions and 15 deletions

View File

@@ -220,11 +220,6 @@ module Spree
total.to_f > 0.0 && !skip_payment_for_subscription?
end
# Indicates the number of items in the order
def item_count
line_items.inject(0) { |sum, li| sum + li.quantity }
end
def backordered?
shipments.any?(&:backordered?)
end

View File

@@ -289,16 +289,6 @@ describe Spree::Order do
end
end
context "#item_count" do
before do
@order = create(:order, user: user)
@order.line_items = [create(:line_item, quantity: 2), create(:line_item, quantity: 1)]
end
it "should return the correct number of items" do
expect(@order.item_count).to eq 3
end
end
context "#amount" do
before do
@order = create(:order, user: user)