Permalink
Browse files

Rename Spree::InventoryUnit.backorder to backordered

  • Loading branch information...
joneslee85 committed Aug 30, 2012
1 parent faaa2df commit 6cc3da52daa3ef57423c0ddbeb4211980ea3103d
Showing with 10 additions and 5 deletions.
  1. +6 −1 core/app/models/spree/inventory_unit.rb
  2. +1 −1 core/app/models/spree/order.rb
  3. +3 −3 core/spec/models/order_spec.rb
@@ -5,7 +5,12 @@ class InventoryUnit < ActiveRecord::Base
belongs_to :shipment
belongs_to :return_authorization
scope :backorder, where(:state => 'backordered')
scope :backordered, where(:state => 'backordered')
def self.backorder
warn "[SPREE] Spree::InventoryUnit.backorder will be deprecated in Spree 1.3. Please use Spree::Product.backordered instead."
backordered
end
attr_accessible :shipment
@@ -144,7 +144,7 @@ def item_count
# Indicates whether there are any backordered InventoryUnits associated with the Order.
def backordered?
return false unless Spree::Config[:track_inventory_levels]
inventory_units.backorder.present?
inventory_units.backordered.present?
end
# Returns the relevant zone (if any) to be used for taxation purposes. Uses default tax zone
@@ -175,16 +175,16 @@ def compute(computable)
context "#backordered?" do
it "should indicate whether any units in the order are backordered" do
order.stub_chain(:inventory_units, :backorder).and_return []
order.stub_chain(:inventory_units, :backordered).and_return []
order.backordered?.should be_false
order.stub_chain(:inventory_units, :backorder).and_return [mock_model(Spree::InventoryUnit)]
order.stub_chain(:inventory_units, :backordered).and_return [mock_model(Spree::InventoryUnit)]
order.backordered?.should be_true
end
it "should always be false when inventory tracking is disabled" do
pending
Spree::Config.set :track_inventory_levels => false
order.stub_chain(:inventory_units, :backorder).and_return [mock_model(Spree::InventoryUnit)]
order.stub_chain(:inventory_units, :backordered).and_return [mock_model(Spree::InventoryUnit)]
order.backordered?.should be_false
end
end

0 comments on commit 6cc3da5

Please sign in to comment.