mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-01 02:03:22 +00:00
Change to using flat rate per item calculators - per-order is confusing when used against line items
This commit is contained in:
@@ -103,7 +103,7 @@ FactoryGirl.define do
|
||||
sequence(:fee_type) { |n| EnterpriseFee::FEE_TYPES[n % EnterpriseFee::FEE_TYPES.count] }
|
||||
|
||||
enterprise { Enterprise.first || FactoryGirl.create(:supplier_enterprise) }
|
||||
calculator { FactoryGirl.build(:calculator, preferred_amount: amount || generate(:calculator_amount)) }
|
||||
calculator { Spree::Calculator::PerItem.new(preferred_amount: amount || generate(:calculator_amount)) }
|
||||
|
||||
after(:create) { |ef| ef.calculator.save! }
|
||||
end
|
||||
|
||||
@@ -39,11 +39,11 @@ feature %q{
|
||||
:country => Spree::Country.find_by_name('Australia')),
|
||||
:pickup_times => 'Tuesday, 4 PM')
|
||||
|
||||
@enterprise_fee_1 = create(:enterprise_fee, :name => 'Enterprise Fee One', :calculator => Spree::Calculator::FlatRate.new)
|
||||
@enterprise_fee_1 = create(:enterprise_fee, :name => 'Enterprise Fee One', :calculator => Spree::Calculator::PerItem.new)
|
||||
@enterprise_fee_1.calculator.set_preference :amount, 1
|
||||
@enterprise_fee_1.calculator.save!
|
||||
|
||||
@enterprise_fee_2 = create(:enterprise_fee, :name => 'Enterprise Fee Two', :calculator => Spree::Calculator::FlatRate.new)
|
||||
@enterprise_fee_2 = create(:enterprise_fee, :name => 'Enterprise Fee Two', :calculator => Spree::Calculator::PerItem.new)
|
||||
@enterprise_fee_2.calculator.set_preference :amount, 2
|
||||
@enterprise_fee_2.calculator.save!
|
||||
|
||||
@@ -175,9 +175,9 @@ feature %q{
|
||||
# Given two distributors and enterprise fees
|
||||
d1 = create(:distributor_enterprise)
|
||||
d2 = create(:distributor_enterprise)
|
||||
ef1 = create(:enterprise_fee, calculator: Spree::Calculator::FlatRate.new)
|
||||
ef1 = create(:enterprise_fee, calculator: Spree::Calculator::PerItem.new)
|
||||
ef1.calculator.set_preference :amount, 1.23; ef1.calculator.save!
|
||||
ef2 = create(:enterprise_fee, calculator: Spree::Calculator::FlatRate.new)
|
||||
ef2 = create(:enterprise_fee, calculator: Spree::Calculator::PerItem.new)
|
||||
ef2.calculator.set_preference :amount, 2.34; ef2.calculator.save!
|
||||
|
||||
# And two products both available from both distributors
|
||||
|
||||
Reference in New Issue
Block a user