WIP: Call fees_for on EnterpriseFeeCalculator

This commit is contained in:
Rohan Mitchell
2014-07-31 09:19:57 +10:00
parent 66cece5903
commit b40b6f9faf
2 changed files with 5 additions and 3 deletions

View File

@@ -1,3 +1,4 @@
require 'open_food_network/enterprise_fee_calculator'
require 'open_food_network/option_value_namer'
Spree::Variant.class_eval do
@@ -44,7 +45,7 @@ Spree::Variant.class_eval do
end
def fees_for(distributor, order_cycle)
order_cycle.fees_for(self, distributor)
OpenFoodNetwork::EnterpriseFeeCalculator.new(distributor, order_cycle).fees_for self
end

View File

@@ -82,12 +82,13 @@ module Spree
describe "calculating the fees" do
it "delegates to order cycle" do
it "delegates to EnterpriseFeeCalculator" do
distributor = double(:distributor)
order_cycle = double(:order_cycle)
variant = Variant.new
order_cycle.should_receive(:fees_for).with(variant, distributor) { 23 }
OpenFoodNetwork::EnterpriseFeeCalculator.any_instance.should_receive(:fees_for).with(variant) { 23 }
variant.fees_for(distributor, order_cycle).should == 23
end
end