mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Update specs for calculator change
This commit is contained in:
@@ -77,13 +77,13 @@ feature %q{
|
||||
page.should have_select "enterprise_fee_set_collection_attributes_0_fee_type", selected: 'Admin'
|
||||
page.should have_selector "input[value='Greetings!']"
|
||||
page.should have_select 'enterprise_fee_set_collection_attributes_0_tax_category_id', selected: 'Inherit From Product'
|
||||
page.should have_selector "option[selected]", text: 'Flat Percent'
|
||||
page.should have_selector "option[selected]", text: 'Flat Percent (per item)'
|
||||
|
||||
fee.reload
|
||||
fee.enterprise.should == enterprise
|
||||
fee.name.should == 'Greetings!'
|
||||
fee.fee_type.should == 'admin'
|
||||
fee.calculator_type.should == "Spree::Calculator::FlatPercentItemTotal"
|
||||
fee.calculator_type.should == "Calculator::FlatPercentPerItem"
|
||||
|
||||
# Sets tax_category and inherits_tax_category
|
||||
fee.tax_category.should == nil
|
||||
|
||||
@@ -28,7 +28,7 @@ feature "shopping with variant overrides defined", js: true, retry: 3 do
|
||||
let!(:vo4) { create(:variant_override, hub: hub, variant: v4, count_on_hand: 3, default_stock: nil, resettable: false) }
|
||||
let!(:vo5) { create(:variant_override, hub: hub, variant: v5, count_on_hand: 0, default_stock: nil, resettable: false) }
|
||||
let!(:vo6) { create(:variant_override, hub: hub, variant: v6, count_on_hand: 6, default_stock: nil, resettable: false) }
|
||||
let(:ef) { create(:enterprise_fee, enterprise: hub, fee_type: 'packing', calculator: Spree::Calculator::FlatPercentItemTotal.new(preferred_flat_percent: 10)) }
|
||||
let(:ef) { create(:enterprise_fee, enterprise: hub, fee_type: 'packing', calculator: Calculator::FlatPercentPerItem.new(preferred_flat_percent: 10)) }
|
||||
|
||||
before do
|
||||
outgoing_exchange.variants = [v1, v2, v3, v4, v5, v6]
|
||||
|
||||
@@ -66,7 +66,7 @@ module OpenFoodNetwork
|
||||
end
|
||||
|
||||
describe "summing percentage fees for the variant" do
|
||||
let!(:enterprise_fee1) { create(:enterprise_fee, amount: 20, fee_type: "admin", calculator: Spree::Calculator::FlatPercentItemTotal.new(preferred_flat_percent: 20)) }
|
||||
let!(:enterprise_fee1) { create(:enterprise_fee, amount: 20, fee_type: "admin", calculator: ::Calculator::FlatPercentPerItem.new(preferred_flat_percent: 20)) }
|
||||
let!(:exchange) { create(:exchange, order_cycle: order_cycle, sender: coordinator, receiver: distributor, incoming: false,
|
||||
enterprise_fees: [enterprise_fee1], variants: [product1.master]) }
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ describe EnterpriseFee do
|
||||
|
||||
it "returns fees with any other calculator" do
|
||||
ef1 = create(:enterprise_fee, calculator: Spree::Calculator::DefaultTax.new)
|
||||
ef2 = create(:enterprise_fee, calculator: Spree::Calculator::FlatPercentItemTotal.new)
|
||||
ef2 = create(:enterprise_fee, calculator: Calculator::FlatPercentPerItem.new)
|
||||
ef3 = create(:enterprise_fee, calculator: Spree::Calculator::PerItem.new)
|
||||
ef4 = create(:enterprise_fee, calculator: Spree::Calculator::PriceSack.new)
|
||||
|
||||
@@ -93,7 +93,7 @@ describe EnterpriseFee do
|
||||
|
||||
it "does not return fees with any other calculator" do
|
||||
ef1 = create(:enterprise_fee, calculator: Spree::Calculator::DefaultTax.new)
|
||||
ef2 = create(:enterprise_fee, calculator: Spree::Calculator::FlatPercentItemTotal.new)
|
||||
ef2 = create(:enterprise_fee, calculator: Calculator::FlatPercentPerItem.new)
|
||||
ef3 = create(:enterprise_fee, calculator: Spree::Calculator::PerItem.new)
|
||||
ef4 = create(:enterprise_fee, calculator: Spree::Calculator::PriceSack.new)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user