Always require invoice VAT rate

Closes #1031
This commit is contained in:
Artur Beljajev 2019-03-07 17:42:21 +02:00
parent d85e57d800
commit 7723a30d1b
17 changed files with 240 additions and 200 deletions

View file

@ -1,20 +1,12 @@
require 'test_helper'
class RegistryTest < ActiveSupport::TestCase
setup do
@registry = Registry.send(:new)
def test_returns_current_registry
Setting.registry_vat_prc = 0.2
Setting.registry_country_code = 'US'
registry = Registry.current
assert_equal 20, registry.vat_rate
assert_equal Country.new(:us), registry.vat_country
end
def test_implements_singleton
assert_equal Registry.instance.object_id, Registry.instance.object_id
end
def test_vat_rate
original_vat_prc = Setting.registry_vat_prc
Setting.registry_vat_prc = 0.25
assert_equal BigDecimal(25), @registry.vat_rate
Setting.registry_vat_prc = original_vat_prc
end
end
end