mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Use ofn's calculator in all tests and add missing translation
This commit is contained in:
@@ -3152,6 +3152,8 @@ See the %{link} to find out more about %{sitename}'s features and to start using
|
||||
please_define_payment_methods: "Please define some payment methods first."
|
||||
options: "Options"
|
||||
has_no_shipped_units: "has no shipped units"
|
||||
order_populator:
|
||||
out_of_stock: ! '%{item} is out of stock.'
|
||||
|
||||
actions:
|
||||
update: "Update"
|
||||
|
||||
@@ -8,7 +8,7 @@ module Spree
|
||||
|
||||
describe "setting included tax" do
|
||||
let(:order) { create(:order) }
|
||||
let(:tax_rate) { create(:tax_rate, amount: 0.1, calculator: Calculator::DefaultTax.new) }
|
||||
let(:tax_rate) { create(:tax_rate, amount: 0.1, calculator: ::Calculator::DefaultTax.new) }
|
||||
|
||||
describe "creating an adjustment" do
|
||||
it "sets included tax to zero when no tax rate is specified" do
|
||||
|
||||
@@ -35,7 +35,7 @@ module Spree
|
||||
end
|
||||
|
||||
describe "finding line items with and without tax" do
|
||||
let(:tax_rate) { create(:tax_rate, calculator: Calculator::DefaultTax.new) }
|
||||
let(:tax_rate) { create(:tax_rate, calculator: ::Calculator::DefaultTax.new) }
|
||||
let!(:adjustment1) { create(:adjustment, originator: tax_rate, label: "TR", amount: 123, included_tax: 10.00) }
|
||||
|
||||
before do
|
||||
@@ -311,7 +311,7 @@ module Spree
|
||||
describe "tax" do
|
||||
let(:li_no_tax) { create(:line_item) }
|
||||
let(:li_tax) { create(:line_item) }
|
||||
let(:tax_rate) { create(:tax_rate, calculator: Calculator::DefaultTax.new) }
|
||||
let(:tax_rate) { create(:tax_rate, calculator: ::Calculator::DefaultTax.new) }
|
||||
let!(:adjustment) { create(:adjustment, adjustable: li_tax, originator: tax_rate, label: "TR", amount: 123, included_tax: 10.00) }
|
||||
|
||||
context "checking if a line item has tax included" do
|
||||
|
||||
@@ -72,10 +72,10 @@ module Spree
|
||||
free_payment_method = create(:payment_method) # flat rate calculator with preferred_amount of 0
|
||||
expect(free_payment_method.compute_amount(order)).to eq 0
|
||||
|
||||
flat_rate_payment_method = create(:payment_method, calculator: Calculator::FlatRate.new(preferred_amount: 10))
|
||||
flat_rate_payment_method = create(:payment_method, calculator: ::Calculator::FlatRate.new(preferred_amount: 10))
|
||||
expect(flat_rate_payment_method.compute_amount(order)).to eq 10
|
||||
|
||||
flat_percent_payment_method = create(:payment_method, calculator: Calculator::FlatPercentItemTotal.new(preferred_flat_percent: 10))
|
||||
flat_percent_payment_method = create(:payment_method, calculator: ::Calculator::FlatPercentItemTotal.new(preferred_flat_percent: 10))
|
||||
expect(flat_percent_payment_method.compute_amount(order)).to eq 0
|
||||
|
||||
product = create(:product)
|
||||
|
||||
@@ -5,7 +5,7 @@ module Spree
|
||||
describe "selecting tax rates to apply to an order" do
|
||||
let!(:zone) { create(:zone_with_member) }
|
||||
let!(:order) { create(:order, distributor: hub, bill_address: create(:address)) }
|
||||
let!(:tax_rate) { create(:tax_rate, included_in_price: true, calculator: Calculator::FlatRate.new(preferred_amount: 0.1), zone: zone) }
|
||||
let!(:tax_rate) { create(:tax_rate, included_in_price: true, calculator: ::Calculator::FlatRate.new(preferred_amount: 0.1), zone: zone) }
|
||||
|
||||
describe "when the order's hub charges sales tax" do
|
||||
let(:hub) { create(:distributor_enterprise, charges_sales_tax: true) }
|
||||
@@ -33,7 +33,7 @@ module Spree
|
||||
end
|
||||
|
||||
describe "ensuring that tax rate is marked as tax included_in_price" do
|
||||
let(:tax_rate) { create(:tax_rate, included_in_price: false, calculator: Calculator::DefaultTax.new) }
|
||||
let(:tax_rate) { create(:tax_rate, included_in_price: false, calculator: ::Calculator::DefaultTax.new) }
|
||||
|
||||
it "sets included_in_price to true" do
|
||||
tax_rate.send(:with_tax_included_in_price) do
|
||||
|
||||
Reference in New Issue
Block a user