Update specs for calculator change

This commit is contained in:
Rohan Mitchell
2016-08-19 17:58:59 +10:00
parent 308c24caf4
commit 24d0e4fcf8
4 changed files with 6 additions and 6 deletions

View File

@@ -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

View File

@@ -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]

View File

@@ -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]) }

View File

@@ -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)