Handling tax categories without tax rates

This commit is contained in:
Maikel Linke
2015-08-21 15:16:00 +10:00
parent 03627e2ef2
commit adc20e9e4e
2 changed files with 7 additions and 1 deletions

View File

@@ -39,7 +39,7 @@ module OpenFoodNetwork
def gst(variant)
tax_category = variant.product.tax_category
if tax_category
if tax_category && tax_category.tax_rates.present?
tax_rate = tax_category.tax_rates.first
line_item = mock_line_item(variant, tax_category)
tax_rate.calculator.compute line_item

View File

@@ -21,5 +21,11 @@ module OpenFoodNetwork
report.send(:grower_and_method, v).should == "Producer (Method)"
end
end
describe "gst" do
it "handles tax category without rates" do
report.send(:gst, v).should == 0
end
end
end
end