valvat 0.9.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/.gitignore +2 -1
  5. data/.travis.yml +30 -16
  6. data/CHANGES.md +13 -0
  7. data/Gemfile +2 -3
  8. data/README.md +90 -44
  9. data/gemfiles/activemodel-3-2 +3 -4
  10. data/gemfiles/activemodel-4 +3 -4
  11. data/gemfiles/activemodel-5 +4 -5
  12. data/gemfiles/activemodel-6 +7 -0
  13. data/gemfiles/before-ruby21/activemodel-3-2 +3 -4
  14. data/gemfiles/before-ruby21/activemodel-4 +3 -4
  15. data/gemfiles/before-ruby21/standalone +3 -4
  16. data/gemfiles/standalone +3 -5
  17. data/lib/active_model/validations/valvat_validator.rb +20 -5
  18. data/lib/valvat.rb +3 -1
  19. data/lib/valvat/checksum/gb.rb +30 -13
  20. data/lib/valvat/checksum/ie.rb +1 -1
  21. data/lib/valvat/error.rb +28 -0
  22. data/lib/valvat/locales/en.yml +1 -1
  23. data/lib/valvat/lookup.rb +11 -43
  24. data/lib/valvat/lookup/fault.rb +30 -0
  25. data/lib/valvat/lookup/request.rb +33 -12
  26. data/lib/valvat/lookup/response.rb +36 -0
  27. data/lib/valvat/version.rb +1 -1
  28. data/spec/active_model/validations/valvat_validator_spec.rb +66 -66
  29. data/spec/valvat/checksum/at_spec.rb +2 -2
  30. data/spec/valvat/checksum/be_spec.rb +2 -2
  31. data/spec/valvat/checksum/bg_spec.rb +2 -2
  32. data/spec/valvat/checksum/cy_spec.rb +2 -2
  33. data/spec/valvat/checksum/de_spec.rb +2 -2
  34. data/spec/valvat/checksum/dk_spec.rb +2 -2
  35. data/spec/valvat/checksum/ee_spec.rb +2 -2
  36. data/spec/valvat/checksum/es_spec.rb +2 -2
  37. data/spec/valvat/checksum/fi_spec.rb +2 -2
  38. data/spec/valvat/checksum/fr_spec.rb +2 -2
  39. data/spec/valvat/checksum/gb_spec.rb +5 -3
  40. data/spec/valvat/checksum/gr_spec.rb +2 -2
  41. data/spec/valvat/checksum/hr_spec.rb +2 -2
  42. data/spec/valvat/checksum/hu_spec.rb +2 -2
  43. data/spec/valvat/checksum/ie_spec.rb +8 -2
  44. data/spec/valvat/checksum/it_spec.rb +4 -4
  45. data/spec/valvat/checksum/lt_spec.rb +2 -2
  46. data/spec/valvat/checksum/lu_spec.rb +2 -2
  47. data/spec/valvat/checksum/mt_spec.rb +2 -2
  48. data/spec/valvat/checksum/nl_spec.rb +2 -2
  49. data/spec/valvat/checksum/pl_spec.rb +3 -3
  50. data/spec/valvat/checksum/pt_spec.rb +2 -2
  51. data/spec/valvat/checksum/ro_spec.rb +2 -2
  52. data/spec/valvat/checksum/se_spec.rb +3 -3
  53. data/spec/valvat/checksum/si_spec.rb +4 -4
  54. data/spec/valvat/checksum_spec.rb +2 -2
  55. data/spec/valvat/lockup/fault_spec.rb +32 -0
  56. data/spec/valvat/lockup/request_spec.rb +15 -0
  57. data/spec/valvat/lockup/response_spec.rb +27 -0
  58. data/spec/valvat/lookup_spec.rb +168 -35
  59. data/spec/valvat/syntax_spec.rb +29 -29
  60. data/spec/valvat/utils_spec.rb +6 -6
  61. data/spec/valvat_spec.rb +18 -18
  62. data/valvat.gemspec +1 -0
  63. metadata +29 -6
  64. metadata.gz.sig +0 -0
  65. data/lib/valvat/lookup/request_with_id.rb +0 -31
@@ -2,13 +2,13 @@ require 'spec_helper'
2
2
 
3
3
  describe Valvat::Checksum::AT do
4
4
  %w(ATU13585627 ATU66059506 ATU42403001).each do |valid_vat|
5
- it "returns true on valid vat #{valid_vat}" do
5
+ it "returns true on valid VAT #{valid_vat}" do
6
6
  expect(Valvat::Checksum.validate(valid_vat)).to eql(true)
7
7
  end
8
8
 
9
9
  invalid_vat = "#{valid_vat[0..-4]}#{valid_vat[-1]}#{valid_vat[-2]}#{valid_vat[-3]}"
10
10
 
11
- it "returns false on invalid vat #{invalid_vat}" do
11
+ it "returns false on invalid VAT #{invalid_vat}" do
12
12
  expect(Valvat::Checksum.validate(invalid_vat)).to eql(false)
13
13
  end
14
14
  end
@@ -2,13 +2,13 @@ require 'spec_helper'
2
2
 
3
3
  describe Valvat::Checksum::BE do
4
4
  %w(BE0123456749 BE0136695962 BE0817331995).each do |valid_vat|
5
- it "returns true on valid vat #{valid_vat}" do
5
+ it "returns true on valid VAT #{valid_vat}" do
6
6
  expect(Valvat::Checksum.validate(valid_vat)).to eql(true)
7
7
  end
8
8
 
9
9
  invalid_vat = "#{valid_vat[0..-3]}#{valid_vat[-1]}#{valid_vat[-2]}"
10
10
 
11
- it "returns false on invalid vat #{invalid_vat}" do
11
+ it "returns false on invalid VAT #{invalid_vat}" do
12
12
  expect(Valvat::Checksum.validate(invalid_vat)).to eql(false)
13
13
  end
14
14
  end
@@ -2,13 +2,13 @@ require 'spec_helper'
2
2
 
3
3
  describe Valvat::Checksum::BG do
4
4
  %w(BG123456786 BG926067143 BG926067770 BG0101011739 BG0121013021 BG5041019992 BG1521687837 BG1431889037).each do |valid_vat|
5
- it "returns true on valid vat #{valid_vat}" do
5
+ it "returns true on valid VAT #{valid_vat}" do
6
6
  expect(Valvat::Checksum.validate(valid_vat)).to eql(true)
7
7
  end
8
8
 
9
9
  invalid_vat = "#{valid_vat[0..-4]}#{valid_vat[-1]}#{valid_vat[-2]}#{valid_vat[-4]}"
10
10
 
11
- it "returns false on invalid vat #{invalid_vat}" do
11
+ it "returns false on invalid VAT #{invalid_vat}" do
12
12
  expect(Valvat::Checksum.validate(invalid_vat)).to eql(false)
13
13
  end
14
14
  end
@@ -2,13 +2,13 @@ require 'spec_helper'
2
2
 
3
3
  describe Valvat::Checksum::CY do
4
4
  %w(CY01234567U CY00532445O).each do |valid_vat|
5
- it "returns true on valid vat #{valid_vat}" do
5
+ it "returns true on valid VAT #{valid_vat}" do
6
6
  expect(Valvat::Checksum.validate(valid_vat)).to be true
7
7
  end
8
8
 
9
9
  invalid_vat = "#{valid_vat[0..-4]}#{valid_vat[-2]}#{valid_vat[-3]}#{valid_vat[-1]}"
10
10
 
11
- it "returns false on invalid vat #{invalid_vat}" do
11
+ it "returns false on invalid VAT #{invalid_vat}" do
12
12
  expect(Valvat::Checksum.validate(invalid_vat)).to be false
13
13
  end
14
14
  end
@@ -2,13 +2,13 @@ require 'spec_helper'
2
2
 
3
3
  describe Valvat::Checksum::DE do
4
4
  %w(DE280857971 DE281381706 DE283108332 DE813622378 DE813628528 DE814178359 DE811907980).each do |valid_vat|
5
- it "returns true on valid vat #{valid_vat}" do
5
+ it "returns true on valid VAT #{valid_vat}" do
6
6
  expect(Valvat::Checksum.validate(valid_vat)).to eql(true)
7
7
  end
8
8
 
9
9
  invalid_vat = "#{valid_vat[0..-3]}#{valid_vat[-1]}#{valid_vat[-2]}"
10
10
 
11
- it "returns false on invalid vat #{invalid_vat}" do
11
+ it "returns false on invalid VAT #{invalid_vat}" do
12
12
  expect(Valvat::Checksum.validate(invalid_vat)).to eql(false)
13
13
  end
14
14
  end
@@ -2,13 +2,13 @@ require 'spec_helper'
2
2
 
3
3
  describe Valvat::Checksum::DK do
4
4
  %w(DK13585628 DK61126228).each do |valid_vat|
5
- it "returns true on valid vat #{valid_vat}" do
5
+ it "returns true on valid VAT #{valid_vat}" do
6
6
  expect(Valvat::Checksum.validate(valid_vat)).to eql(true)
7
7
  end
8
8
 
9
9
  invalid_vat = "#{valid_vat[0..-3]}#{valid_vat[-1]}#{valid_vat[-2]}"
10
10
 
11
- it "returns false on invalid vat #{invalid_vat}" do
11
+ it "returns false on invalid VAT #{invalid_vat}" do
12
12
  expect(Valvat::Checksum.validate(invalid_vat)).to eql(false)
13
13
  end
14
14
  end
@@ -2,13 +2,13 @@ require 'spec_helper'
2
2
 
3
3
  describe Valvat::Checksum::EE do
4
4
  %w(EE101234568 EE100207415).each do |valid_vat|
5
- it "returns true on valid vat #{valid_vat}" do
5
+ it "returns true on valid VAT #{valid_vat}" do
6
6
  expect(Valvat::Checksum.validate(valid_vat)).to be true
7
7
  end
8
8
 
9
9
  invalid_vat = "#{valid_vat[0..-3]}#{valid_vat[-1]}#{valid_vat[-2]}"
10
10
 
11
- it "returns false on invalid vat #{invalid_vat}" do
11
+ it "returns false on invalid VAT #{invalid_vat}" do
12
12
  expect(Valvat::Checksum.validate(invalid_vat)).to be false
13
13
  end
14
14
  end
@@ -2,13 +2,13 @@ require 'spec_helper'
2
2
 
3
3
  describe Valvat::Checksum::ES do
4
4
  %w(ESA13585625 ESB83871236 ESE54507058 ES25139013J ESQ1518001A ESQ5018001G ESX4942978W ESX7676464F ESB10317980 ESY3860557K ESY2207765D).each do |valid_vat|
5
- it "returns true on valid vat #{valid_vat}" do
5
+ it "returns true on valid VAT #{valid_vat}" do
6
6
  expect(Valvat::Checksum.validate(valid_vat)).to eql(true)
7
7
  end
8
8
 
9
9
  invalid_vat = "#{valid_vat[0..-6]}#{valid_vat[-2]}#{valid_vat[-5]}#{valid_vat[-4]}#{valid_vat[-3]}#{valid_vat[-1]}"
10
10
 
11
- it "returns false on invalid vat #{invalid_vat}" do
11
+ it "returns false on invalid VAT #{invalid_vat}" do
12
12
  expect(Valvat::Checksum.validate(invalid_vat)).to eql(false)
13
13
  end
14
14
  end
@@ -2,13 +2,13 @@ require 'spec_helper'
2
2
 
3
3
  describe Valvat::Checksum::FI do
4
4
  %w(FI13669598 FI20584306 FI01080233).each do |valid_vat|
5
- it "returns true on valid vat #{valid_vat}" do
5
+ it "returns true on valid VAT #{valid_vat}" do
6
6
  expect(Valvat::Checksum.validate(valid_vat)).to eql(true)
7
7
  end
8
8
 
9
9
  invalid_vat = "#{valid_vat[0..-4]}#{valid_vat[-1]}#{valid_vat[-2]}#{valid_vat[-3]}"
10
10
 
11
- it "returns false on invalid vat #{invalid_vat}" do
11
+ it "returns false on invalid VAT #{invalid_vat}" do
12
12
  expect(Valvat::Checksum.validate(invalid_vat)).to eql(false)
13
13
  end
14
14
  end
@@ -2,13 +2,13 @@ require 'spec_helper'
2
2
 
3
3
  describe Valvat::Checksum::FR do
4
4
  %w(FR60528551658 FR43820567501).each do |valid_vat|
5
- it "returns true on valid vat #{valid_vat}" do
5
+ it "returns true on valid VAT #{valid_vat}" do
6
6
  expect(Valvat::Checksum.validate(valid_vat)).to eql(true)
7
7
  end
8
8
 
9
9
  invalid_vat = "#{valid_vat[0..-3]}#{valid_vat[-1]}#{valid_vat[-2]}"
10
10
 
11
- it "returns false on invalid vat #{invalid_vat}" do
11
+ it "returns false on invalid VAT #{invalid_vat}" do
12
12
  expect(Valvat::Checksum.validate(invalid_vat)).to eql(false)
13
13
  end
14
14
  end
@@ -1,6 +1,8 @@
1
+ require 'spec_helper'
2
+
1
3
  describe Valvat::Checksum::GB do
2
4
  %w(GBGD100 GBHA600).each do |gov_agency_vat|
3
- it "returns true on valid vat for government agency #{gov_agency_vat}" do
5
+ it "returns true on valid VAT for government agency #{gov_agency_vat}" do
4
6
  expect(Valvat::Checksum.validate(gov_agency_vat)).to be true
5
7
  end
6
8
  end
@@ -19,11 +21,11 @@ describe Valvat::Checksum::GB do
19
21
  expect(Valvat::Checksum.validate('GB434031439')).to be true
20
22
  end
21
23
 
22
- it 'is false for an old format vat in forbidden group' do
24
+ it 'is false for an old format VAT in forbidden group' do
23
25
  expect(Valvat::Checksum.validate('GB999999973')).to be false
24
26
  end
25
27
 
26
- it 'is false for a new format vat in forbidden group' do
28
+ it 'is false for a new format VAT in forbidden group' do
27
29
  expect(Valvat::Checksum.validate('GB100000034')).to be false
28
30
  end
29
31
  end
@@ -2,13 +2,13 @@ require 'spec_helper'
2
2
 
3
3
  describe Valvat::Checksum::GR do
4
4
  %w(EL123456783 EL094543092 EL998219694).each do |valid_vat|
5
- it "returns true on valid vat #{valid_vat}" do
5
+ it "returns true on valid VAT #{valid_vat}" do
6
6
  expect(Valvat::Checksum.validate(valid_vat)).to eql(true)
7
7
  end
8
8
 
9
9
  invalid_vat = "#{valid_vat[0..-3]}#{valid_vat[-1]}#{valid_vat[-2]}"
10
10
 
11
- it "returns false on invalid vat #{invalid_vat}" do
11
+ it "returns false on invalid VAT #{invalid_vat}" do
12
12
  expect(Valvat::Checksum.validate(invalid_vat)).to eql(false)
13
13
  end
14
14
  end
@@ -2,13 +2,13 @@ require 'spec_helper'
2
2
 
3
3
  describe Valvat::Checksum::HR do
4
4
  %w(HR06282943396 HR17099025134).each do |valid_vat|
5
- it "returns true on valid vat #{valid_vat}" do
5
+ it "returns true on valid VAT #{valid_vat}" do
6
6
  expect(Valvat::Checksum.validate(valid_vat)).to be true
7
7
  end
8
8
 
9
9
  invalid_vat = "#{valid_vat[0..-3]}#{valid_vat[-1]}#{valid_vat[-2]}"
10
10
 
11
- it "returns false on invalid vat #{invalid_vat}" do
11
+ it "returns false on invalid VAT #{invalid_vat}" do
12
12
  expect(Valvat::Checksum.validate(invalid_vat)).to be false
13
13
  end
14
14
  end
@@ -2,13 +2,13 @@ require 'spec_helper'
2
2
 
3
3
  describe Valvat::Checksum::HU do
4
4
  %w(HU10672101 HU13460370 HU10747759).each do |valid_vat|
5
- it "returns true on valid vat #{valid_vat}" do
5
+ it "returns true on valid VAT #{valid_vat}" do
6
6
  expect(Valvat::Checksum.validate(valid_vat)).to be true
7
7
  end
8
8
 
9
9
  invalid_vat = "#{valid_vat[0..-3]}#{valid_vat[-1]}#{valid_vat[-2]}"
10
10
 
11
- it "returns false on invalid vat #{invalid_vat}" do
11
+ it "returns false on invalid VAT #{invalid_vat}" do
12
12
  expect(Valvat::Checksum.validate(invalid_vat)).to be false
13
13
  end
14
14
  end
@@ -3,13 +3,19 @@ require 'spec_helper'
3
3
  describe Valvat::Checksum::IE do
4
4
  %w(IE8473625E IE0123459N IE9B12345N IE1113571MH IE2973912UH IE2974611LH
5
5
  IE2974901UH IE3200115LH IE3206791MH IE3208913KH IE3214048CH).each do |valid_vat|
6
- it "returns true on valid vat #{valid_vat}" do
6
+ it "returns true on valid VAT #{valid_vat}" do
7
7
  expect(Valvat::Checksum.validate(valid_vat)).to eql(true), valid_vat
8
8
  end
9
9
 
10
10
  invalid_vat = "#{valid_vat[0..-4]}#{valid_vat[-2]}#{valid_vat[-3]}#{valid_vat[-1]}"
11
11
 
12
- it "returns false on invalid vat #{invalid_vat}" do
12
+ it "returns false on invalid VAT #{invalid_vat}" do
13
+ expect(Valvat::Checksum.validate(invalid_vat)).to eql(false)
14
+ end
15
+ end
16
+
17
+ %w(IE0000000XX IE0000000AZ).each do |invalid_vat|
18
+ it "returns false on invalid VAT #{invalid_vat}" do
13
19
  expect(Valvat::Checksum.validate(invalid_vat)).to eql(false)
14
20
  end
15
21
  end
@@ -2,22 +2,22 @@ require 'spec_helper'
2
2
 
3
3
  describe Valvat::Checksum::IT do
4
4
  %w(IT12345670785 IT01897810162 IT00197200132 IT02762750210).each do |valid_vat|
5
- it "returns true on valid vat #{valid_vat}" do
5
+ it "returns true on valid VAT #{valid_vat}" do
6
6
  expect(Valvat::Checksum.validate(valid_vat)).to eql(true)
7
7
  end
8
8
 
9
9
  invalid_vat = "#{valid_vat[0..-3]}#{valid_vat[-1]}#{valid_vat[-2]}"
10
10
 
11
- it "returns false on invalid vat #{invalid_vat}" do
11
+ it "returns false on invalid VAT #{invalid_vat}" do
12
12
  expect(Valvat::Checksum.validate(invalid_vat)).to eql(false)
13
13
  end
14
14
  end
15
15
 
16
- it "returns false on invalid special case vat IT12345671783" do
16
+ it "returns false on invalid special case VAT IT12345671783" do
17
17
  expect(Valvat::Checksum.validate("IT12345671783")).to eql(false)
18
18
  end
19
19
 
20
- it "returns false on invalid special case vat IT00000000133" do
20
+ it "returns false on invalid special case VAT IT00000000133" do
21
21
  expect(Valvat::Checksum.validate("IT00000000133")).to eql(false)
22
22
  end
23
23
  end
@@ -2,13 +2,13 @@ require 'spec_helper'
2
2
 
3
3
  describe Valvat::Checksum::LT do
4
4
  %w(LT213179412 LT290061371314).each do |valid_vat|
5
- it "returns true on valid vat #{valid_vat}" do
5
+ it "returns true on valid VAT #{valid_vat}" do
6
6
  expect(Valvat::Checksum.validate(valid_vat)).to be true
7
7
  end
8
8
 
9
9
  invalid_vat = "#{valid_vat[0..-3]}#{valid_vat[-1]}#{valid_vat[-2]}"
10
10
 
11
- it "returns false on invalid vat #{invalid_vat}" do
11
+ it "returns false on invalid VAT #{invalid_vat}" do
12
12
  expect(Valvat::Checksum.validate(invalid_vat)).to be false
13
13
  end
14
14
  end
@@ -2,13 +2,13 @@ require 'spec_helper'
2
2
 
3
3
  describe Valvat::Checksum::LU do
4
4
  %w(LU13669580 LU25361352 LU23124018 LU17560609).each do |valid_vat|
5
- it "returns true on valid vat #{valid_vat}" do
5
+ it "returns true on valid VAT #{valid_vat}" do
6
6
  expect(Valvat::Checksum.validate(valid_vat)).to eql(true)
7
7
  end
8
8
 
9
9
  invalid_vat = "#{valid_vat[0..-4]}#{valid_vat[-2]}#{valid_vat[-3]}#{valid_vat[-1]}"
10
10
 
11
- it "returns false on invalid vat #{invalid_vat}" do
11
+ it "returns false on invalid VAT #{invalid_vat}" do
12
12
  expect(Valvat::Checksum.validate(invalid_vat)).to eql(false)
13
13
  end
14
14
  end
@@ -2,13 +2,13 @@ require 'spec_helper'
2
2
 
3
3
  describe Valvat::Checksum::MT do
4
4
  %w(MT11407334 MT10126313 MT11539237).each do |valid_vat|
5
- it "returns true on valid vat #{valid_vat}" do
5
+ it "returns true on valid VAT #{valid_vat}" do
6
6
  expect(Valvat::Checksum.validate(valid_vat)).to be true
7
7
  end
8
8
 
9
9
  invalid_vat = "#{valid_vat[0..-3]}#{valid_vat[-1]}#{valid_vat[-2]}"
10
10
 
11
- it "returns false on invalid vat #{invalid_vat}" do
11
+ it "returns false on invalid VAT #{invalid_vat}" do
12
12
  expect(Valvat::Checksum.validate(invalid_vat)).to be false
13
13
  end
14
14
  end
@@ -2,13 +2,13 @@ require 'spec_helper'
2
2
 
3
3
  describe Valvat::Checksum::NL do
4
4
  %w(NL123456782B12 NL802549391B01 NL808661863B01 NL820893559B01 NL000099998B57 NL123456789B13).each do |valid_vat|
5
- it "returns true on valid vat #{valid_vat}" do
5
+ it "returns true on valid VAT #{valid_vat}" do
6
6
  expect(Valvat::Checksum.validate(valid_vat)).to eql(true)
7
7
  end
8
8
 
9
9
  invalid_vat = "#{valid_vat[0..-5]}#{valid_vat[-2]}#{valid_vat[-3]}#{valid_vat[-4]}#{valid_vat[-1]}#{valid_vat[-2]}#{valid_vat[-3]}"
10
10
 
11
- it "returns false on invalid vat #{invalid_vat}" do
11
+ it "returns false on invalid VAT #{invalid_vat}" do
12
12
  expect(Valvat::Checksum.validate(invalid_vat)).to eql(false)
13
13
  end
14
14
  end
@@ -2,18 +2,18 @@ require 'spec_helper'
2
2
 
3
3
  describe Valvat::Checksum::PL do
4
4
  %w(PL8567346215 PL5260211587 PL9720575348 PL5272650022).each do |valid_vat|
5
- it "returns true on valid vat #{valid_vat}" do
5
+ it "returns true on valid VAT #{valid_vat}" do
6
6
  expect(Valvat::Checksum.validate(valid_vat)).to eql(true)
7
7
  end
8
8
 
9
9
  invalid_vat = "#{valid_vat[0..-4]}#{valid_vat[-1]}#{valid_vat[-2]}#{valid_vat[-3]}"
10
10
 
11
- it "returns false on invalid vat #{invalid_vat}" do
11
+ it "returns false on invalid VAT #{invalid_vat}" do
12
12
  expect(Valvat::Checksum.validate(invalid_vat)).to eql(false)
13
13
  end
14
14
  end
15
15
 
16
- it "returns false on special case invalid vat PL8566445330" do
16
+ it "returns false on special case invalid VAT PL8566445330" do
17
17
  expect(Valvat::Checksum.validate("PL8566445330")).to eql(false)
18
18
  end
19
19
  end
@@ -5,13 +5,13 @@ describe Valvat::Checksum::PT do
5
5
  subject { Valvat::Checksum }
6
6
 
7
7
  %w(PT136695973 PT501413197 PT503037753 PT500243590 PT500100144 PT502921838).each do |valid_vat|
8
- it "returns true on valid vat #{valid_vat}" do
8
+ it "returns true on valid VAT #{valid_vat}" do
9
9
  expect(subject.validate(valid_vat)).to eql(true)
10
10
  end
11
11
 
12
12
  invalid_vat = "#{valid_vat[0..-5]}#{valid_vat[-1]}#{valid_vat[-4]}#{valid_vat[-2]}#{valid_vat[-3]}"
13
13
 
14
- it "returns false on invalid vat #{invalid_vat}" do
14
+ it "returns false on invalid VAT #{invalid_vat}" do
15
15
  expect(subject.validate(invalid_vat)).to eql(false)
16
16
  end
17
17
  end
@@ -2,13 +2,13 @@ require 'spec_helper'
2
2
 
3
3
  describe Valvat::Checksum::RO do
4
4
  %w(RO123456789 RO99908 RO19 RO124 RO13182060).each do |valid_vat|
5
- it "returns true on valid vat #{valid_vat}" do
5
+ it "returns true on valid VAT #{valid_vat}" do
6
6
  expect(Valvat::Checksum.validate(valid_vat)).to be true
7
7
  end
8
8
 
9
9
  invalid_vat = "#{valid_vat[0..-3]}#{valid_vat[-1]}#{valid_vat[-2]}"
10
10
 
11
- it "returns false on invalid vat #{invalid_vat}" do
11
+ it "returns false on invalid VAT #{invalid_vat}" do
12
12
  expect(Valvat::Checksum.validate(invalid_vat)).to be false
13
13
  end
14
14
  end
@@ -2,18 +2,18 @@ require 'spec_helper'
2
2
 
3
3
  describe Valvat::Checksum::SE do
4
4
  %w(SE136695975501 SE556464687401 SE502052817901 SE556555952201 SE556084097601).each do |valid_vat|
5
- it "returns true on valid vat #{valid_vat}" do
5
+ it "returns true on valid VAT #{valid_vat}" do
6
6
  expect(Valvat::Checksum.validate(valid_vat)).to eql(true)
7
7
  end
8
8
 
9
9
  invalid_vat = "#{valid_vat[0..-4]}#{valid_vat[-1]}#{valid_vat[-2]}#{valid_vat[-3]}"
10
10
 
11
- it "returns false on invalid vat #{invalid_vat}" do
11
+ it "returns false on invalid VAT #{invalid_vat}" do
12
12
  expect(Valvat::Checksum.validate(invalid_vat)).to eql(false)
13
13
  end
14
14
  end
15
15
 
16
- it "returns false on special case invalid vat SE556464687400" do
16
+ it "returns false on special case invalid VAT SE556464687400" do
17
17
  expect(Valvat::Checksum.validate("SE556464687400")).to eql(false)
18
18
  end
19
19
  end
@@ -2,22 +2,22 @@ require 'spec_helper'
2
2
 
3
3
  describe Valvat::Checksum::SI do
4
4
  %w(SI59082437 SI51049406 SI86154575 SI47431857 SI22511822 SI26833921).each do |valid_vat|
5
- it "returns true on valid vat #{valid_vat}" do
5
+ it "returns true on valid VAT #{valid_vat}" do
6
6
  expect(Valvat::Checksum.validate(valid_vat)).to eql(true)
7
7
  end
8
8
 
9
9
  invalid_vat = "#{valid_vat[0..-2]}#{valid_vat[-1].to_i+1}"
10
10
 
11
- it "returns false on invalid vat #{invalid_vat}" do
11
+ it "returns false on invalid VAT #{invalid_vat}" do
12
12
  expect(Valvat::Checksum.validate(invalid_vat)).to eql(false)
13
13
  end
14
14
  end
15
15
 
16
- it "returns false on special case invalid vat SI11111107" do
16
+ it "returns false on special case invalid VAT SI11111107" do
17
17
  expect(Valvat::Checksum.validate("SI11111107")).to eql(false)
18
18
  end
19
19
 
20
- it "returns false on special case invalid vat SI01111108" do
20
+ it "returns false on special case invalid VAT SI01111108" do
21
21
  expect(Valvat::Checksum.validate("SI01111108")).to eql(false)
22
22
  end
23
23
  end