diff --git a/app/models/spree/product_decorator.rb b/app/models/spree/product_decorator.rb index e11b0c2375..dc0b1bbf35 100644 --- a/app/models/spree/product_decorator.rb +++ b/app/models/spree/product_decorator.rb @@ -80,23 +80,6 @@ Spree::Product.class_eval do self.product_distributions.find_by_distributor_id(distributor) end - # This method is called on products that are distributed via order cycles, but at the time of - # writing (27-5-2013), order cycle fees were not implemented, so there's no defined result - # that this method should return. As a stopgap, we notify Bugsnag of the situation and return - # an undefined, but valid shipping method. When order cycle fees are implemented, this method - # should return the order cycle shipping method, or raise an exepction with the message, - # "This product is not available through that distributor". - def shipping_method_for_distributor(distributor) - distribution = product_distribution_for distributor - - unless distribution - Bugsnag.notify(Exception.new "No product distribution for product #{id} at distributor #{distributor.andand.id}. Perhaps this product is distributed via an order cycle? This is a warning that OrderCycle fees and shipping methods are not yet implemented, and the shipping fee charged is undefined until then.") - end - - distribution.andand.shipping_method || Spree::ShippingMethod.where("name != 'Delivery'").last - end - - # Build a product distribution for each distributor def build_product_distributions_for_user user Enterprise.is_distributor.managed_by(user).each do |distributor| diff --git a/spec/models/product_spec.rb b/spec/models/product_spec.rb index b6d9e5ac36..e60ebb0281 100644 --- a/spec/models/product_spec.rb +++ b/spec/models/product_spec.rb @@ -191,24 +191,6 @@ module Spree product_distribution = create(:product_distribution, product: product, distributor: distributor) product.product_distribution_for(distributor).should == product_distribution end - - it "finds the shipping method for a particular distributor" do - shipping_method = create(:shipping_method) - distributor = create(:distributor_enterprise) - product = create(:product) - product_distribution = create(:product_distribution, product: product, distributor: distributor, shipping_method: shipping_method) - product.shipping_method_for_distributor(distributor).should == shipping_method - end - - it "logs an error and returns an undefined shipping method if distributor is not found" do - distributor = create(:distributor_enterprise) - product = create(:product) - - Bugsnag.should_receive(:notify) - - product.shipping_method_for_distributor(distributor).should == - Spree::ShippingMethod.where("name != 'Delivery'").last - end end describe "membership" do