mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-04-03 06:59:14 +00:00
WIP: Call fees_for on EnterpriseFeeCalculator
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user