br_inscricao_estadual 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +7 -0
  2. data/.coveralls.yml +1 -0
  3. data/.gitignore +18 -0
  4. data/.travis.yml +3 -0
  5. data/Gemfile +4 -0
  6. data/LICENSE +674 -0
  7. data/LICENSE.txt +22 -0
  8. data/README.md +40 -0
  9. data/Rakefile +16 -0
  10. data/br_inscricao_estadual.gemspec +29 -0
  11. data/lib/br_inscricao_estadual/ac.rb +12 -0
  12. data/lib/br_inscricao_estadual/al.rb +15 -0
  13. data/lib/br_inscricao_estadual/am.rb +21 -0
  14. data/lib/br_inscricao_estadual/ap.rb +37 -0
  15. data/lib/br_inscricao_estadual/ba.rb +16 -0
  16. data/lib/br_inscricao_estadual/ba_8.rb +14 -0
  17. data/lib/br_inscricao_estadual/ba_9.rb +15 -0
  18. data/lib/br_inscricao_estadual/base.rb +27 -0
  19. data/lib/br_inscricao_estadual/ce.rb +7 -0
  20. data/lib/br_inscricao_estadual/common.rb +54 -0
  21. data/lib/br_inscricao_estadual/df.rb +7 -0
  22. data/lib/br_inscricao_estadual/es.rb +12 -0
  23. data/lib/br_inscricao_estadual/go.rb +38 -0
  24. data/lib/br_inscricao_estadual/ma.rb +8 -0
  25. data/lib/br_inscricao_estadual/mg.rb +10 -0
  26. data/lib/br_inscricao_estadual/ms.rb +8 -0
  27. data/lib/br_inscricao_estadual/mt.rb +9 -0
  28. data/lib/br_inscricao_estadual/pa.rb +8 -0
  29. data/lib/br_inscricao_estadual/pb.rb +7 -0
  30. data/lib/br_inscricao_estadual/pe.rb +8 -0
  31. data/lib/br_inscricao_estadual/pi.rb +7 -0
  32. data/lib/br_inscricao_estadual/pr.rb +10 -0
  33. data/lib/br_inscricao_estadual/rj.rb +9 -0
  34. data/lib/br_inscricao_estadual/rn.rb +8 -0
  35. data/lib/br_inscricao_estadual/rn_10.rb +18 -0
  36. data/lib/br_inscricao_estadual/rn_9.rb +17 -0
  37. data/lib/br_inscricao_estadual/ro.rb +24 -0
  38. data/lib/br_inscricao_estadual/rr.rb +14 -0
  39. data/lib/br_inscricao_estadual/rs.rb +14 -0
  40. data/lib/br_inscricao_estadual/sc.rb +4 -0
  41. data/lib/br_inscricao_estadual/se.rb +6 -0
  42. data/lib/br_inscricao_estadual/sp.rb +27 -0
  43. data/lib/br_inscricao_estadual/sp_p.rb +15 -0
  44. data/lib/br_inscricao_estadual/to.rb +16 -0
  45. data/lib/br_inscricao_estadual/version.rb +3 -0
  46. data/lib/br_inscricao_estadual.rb +41 -0
  47. data/spec/br_inscricao_estadual/ac_spec.rb +16 -0
  48. data/spec/br_inscricao_estadual/al_spec.rb +16 -0
  49. data/spec/br_inscricao_estadual/am_spec.rb +26 -0
  50. data/spec/br_inscricao_estadual/ap_spec.rb +40 -0
  51. data/spec/br_inscricao_estadual/ba_spec.rb +48 -0
  52. data/spec/br_inscricao_estadual/base_spec.rb +19 -0
  53. data/spec/br_inscricao_estadual/ce_spec.rb +16 -0
  54. data/spec/br_inscricao_estadual/df_spec.rb +21 -0
  55. data/spec/br_inscricao_estadual/es_spec.rb +16 -0
  56. data/spec/br_inscricao_estadual/go_spec.rb +36 -0
  57. data/spec/br_inscricao_estadual/ma_spec.rb +16 -0
  58. data/spec/br_inscricao_estadual/mg_spec.rb +16 -0
  59. data/spec/br_inscricao_estadual/ms_spec.rb +16 -0
  60. data/spec/br_inscricao_estadual/mt_spec.rb +16 -0
  61. data/spec/br_inscricao_estadual/pa_spec.rb +16 -0
  62. data/spec/br_inscricao_estadual/pb_spec.rb +16 -0
  63. data/spec/br_inscricao_estadual/pe_spec.rb +16 -0
  64. data/spec/br_inscricao_estadual/pi_spec.rb +16 -0
  65. data/spec/br_inscricao_estadual/pr_spec.rb +16 -0
  66. data/spec/br_inscricao_estadual/rj_spec.rb +16 -0
  67. data/spec/br_inscricao_estadual/rn_spec.rb +27 -0
  68. data/spec/br_inscricao_estadual/ro_spec.rb +26 -0
  69. data/spec/br_inscricao_estadual/rr_spec.rb +18 -0
  70. data/spec/br_inscricao_estadual/rs_spec.rb +16 -0
  71. data/spec/br_inscricao_estadual/sc_spec.rb +16 -0
  72. data/spec/br_inscricao_estadual/se_spec.rb +16 -0
  73. data/spec/br_inscricao_estadual/sp_spec.rb +25 -0
  74. data/spec/br_inscricao_estadual/to_spec.rb +21 -0
  75. data/spec/br_inscricao_estadual_spec.rb +8 -0
  76. data/spec/spec_helper.rb +12 -0
  77. metadata +264 -0
@@ -0,0 +1,16 @@
1
+ module BrInscricaoEstadual
2
+ class TO < Common
3
+ def valid?
4
+ super && type
5
+ end
6
+
7
+ protected
8
+ PESO = [9, 8, 0, 0, 7, 6, 5, 4, 3, 2]
9
+ STATE_INSC_SIZE = 11
10
+ DIGITS_ZERO = [0,1,10,11]
11
+
12
+ def type
13
+ %w(01 02 03 99).include?(self.insc_est[2..3])
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,3 @@
1
+ module BrInscricaoEstadual
2
+ VERSION = "0.0.2"
3
+ end
@@ -0,0 +1,41 @@
1
+ require "br_inscricao_estadual/version"
2
+ require "br_inscricao_estadual/common"
3
+ require "br_inscricao_estadual/base"
4
+ require "br_inscricao_estadual/ac"
5
+ require "br_inscricao_estadual/al"
6
+ require "br_inscricao_estadual/ap"
7
+ require "br_inscricao_estadual/am"
8
+ require "br_inscricao_estadual/ba"
9
+ require "br_inscricao_estadual/ba_8"
10
+ require "br_inscricao_estadual/ba_9"
11
+ require "br_inscricao_estadual/ce"
12
+ require "br_inscricao_estadual/df"
13
+ require "br_inscricao_estadual/es"
14
+ require "br_inscricao_estadual/go"
15
+ require "br_inscricao_estadual/ma"
16
+ require "br_inscricao_estadual/mt"
17
+ require "br_inscricao_estadual/ms"
18
+ require "br_inscricao_estadual/mg"
19
+ require "br_inscricao_estadual/pa"
20
+ require "br_inscricao_estadual/pb"
21
+ require "br_inscricao_estadual/pr"
22
+ require "br_inscricao_estadual/pe"
23
+ require "br_inscricao_estadual/pi"
24
+ require "br_inscricao_estadual/rj"
25
+ require "br_inscricao_estadual/rn"
26
+ require "br_inscricao_estadual/rn_9"
27
+ require "br_inscricao_estadual/rn_10"
28
+ require "br_inscricao_estadual/rs"
29
+ require "br_inscricao_estadual/ro"
30
+ require "br_inscricao_estadual/rr"
31
+ require "br_inscricao_estadual/sc"
32
+ require "br_inscricao_estadual/sp"
33
+ require "br_inscricao_estadual/sp_p"
34
+ require "br_inscricao_estadual/se"
35
+ require "br_inscricao_estadual/to"
36
+
37
+ module BrInscricaoEstadual
38
+ end
39
+
40
+
41
+
@@ -0,0 +1,16 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ describe BrInscricaoEstadual::AC do
5
+
6
+ it "should valid Acre states incription" do
7
+ insc_est = BrInscricaoEstadual::AC.new('01.004.823/001-12')
8
+ insc_est.should be_valid
9
+ end
10
+
11
+ it "should not valid Acre states incription" do
12
+ insc_est = BrInscricaoEstadual::AC.new('01.004.823/001-14')
13
+ insc_est.should_not be_valid
14
+ end
15
+
16
+ end
@@ -0,0 +1,16 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ describe BrInscricaoEstadual::AL do
5
+
6
+ it "should valid Alagoas states incription" do
7
+ insc_est = BrInscricaoEstadual::AL.new('2 4 0 0 0 0 0 4 8')
8
+ insc_est.should be_valid
9
+ end
10
+
11
+ it "should not valid Alagoas states incription" do
12
+ insc_est = BrInscricaoEstadual::AL.new('2 4 0 0 0 0 0 4 D')
13
+ insc_est.should_not be_valid
14
+ end
15
+
16
+ end
@@ -0,0 +1,26 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ describe BrInscricaoEstadual::AM do
5
+
6
+ it "should valid Amazonas states incription" do
7
+ insc_est = BrInscricaoEstadual::AM.new('99.999.999-1')
8
+ insc_est.should be_valid
9
+ end
10
+
11
+ it "should valid Amazonas states incription" do
12
+ insc_est = BrInscricaoEstadual::AM.new('11.111.222-0')
13
+ insc_est.should be_valid
14
+ end
15
+
16
+ it "should valid Amazonas states incription" do
17
+ insc_est = BrInscricaoEstadual::AM.new('00.000.001-2')
18
+ insc_est.should be_valid
19
+ end
20
+
21
+ it "should not valid Amazonas states incription" do
22
+ insc_est = BrInscricaoEstadual::AM.new('99.999.999-8')
23
+ insc_est.should_not be_valid
24
+ end
25
+
26
+ end
@@ -0,0 +1,40 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ describe BrInscricaoEstadual::AP do
5
+
6
+ it "should valid Amapa states incription" do
7
+ insc_est = BrInscricaoEstadual::AP.new('030123459')
8
+ insc_est.should be_valid
9
+ end
10
+
11
+ it "should valid Amapa states incription" do
12
+ insc_est = BrInscricaoEstadual::AP.new('030170011')
13
+ insc_est.should be_valid
14
+ end
15
+
16
+ it "should valid Amapa states incription" do
17
+ insc_est = BrInscricaoEstadual::AP.new('030190231')
18
+ insc_est.should be_valid
19
+ end
20
+
21
+ it "should valid Amapa states incription" do
22
+ insc_est = BrInscricaoEstadual::AP.new('039999998')
23
+ insc_est.should be_valid
24
+ end
25
+
26
+ pending "criar teste para quando o resto da divisao - 11 = 11"
27
+
28
+
29
+ it "should not valid Amapa states incription" do
30
+ insc_est = BrInscricaoEstadual::AP.new('030123458')
31
+ insc_est.should_not be_valid
32
+ end
33
+
34
+
35
+ it "should not valid Amapa states incription" do
36
+ insc_est = BrInscricaoEstadual::AP.new('03012345')
37
+ insc_est.should_not be_valid
38
+ end
39
+
40
+ end
@@ -0,0 +1,48 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ describe BrInscricaoEstadual::BA do
5
+
6
+ it "should valid Bahia states incription with size 8" do
7
+ insc_est = BrInscricaoEstadual::BA.new('123456-63')
8
+ insc_est.should be_valid
9
+ end
10
+
11
+ it "should not valid Bahia states incription with size 8" do
12
+ insc_est = BrInscricaoEstadual::BA.new('123457-63')
13
+ insc_est.should_not be_valid
14
+ end
15
+
16
+ it "should valid Bahia states incription with size 8 and start 6,7 or 9" do
17
+ insc_est = BrInscricaoEstadual::BA.new('612345-57')
18
+ insc_est.should be_valid
19
+ end
20
+
21
+ it "should not valid Bahia states incription with size 8 and start 6,7 or 9" do
22
+ insc_est = BrInscricaoEstadual::BA.new('612375-57')
23
+ insc_est.should_not be_valid
24
+ end
25
+
26
+
27
+ it "should valid Bahia states incription with size 9" do
28
+ insc_est = BrInscricaoEstadual::BA.new('1000003-06')
29
+ insc_est.should be_valid
30
+ end
31
+
32
+ it "should not valid Bahia states incription with size 9" do
33
+ insc_est = BrInscricaoEstadual::BA.new('1000503-06')
34
+ insc_est.should_not be_valid
35
+ end
36
+
37
+ it "should valid Bahia states incription with size 9 and start 6,7 or 9" do
38
+ insc_est = BrInscricaoEstadual::BA.new('6123456-07')
39
+ insc_est.should be_valid
40
+ end
41
+
42
+ it "should not valid Bahia states incription with size 9 and start 6,7 or 9" do
43
+ insc_est = BrInscricaoEstadual::BA.new('6123756-57')
44
+ insc_est.should_not be_valid
45
+ end
46
+
47
+
48
+ end
@@ -0,0 +1,19 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ describe BrInscricaoEstadual::Base do
5
+
6
+ it "should return valid inscription to AC state" do
7
+ insc_est = BrInscricaoEstadual::Base.new('01.004.823/001-12','AC')
8
+ insc_est.should be_valid
9
+ end
10
+
11
+ it "should return invalid inscription to AC state" do
12
+ insc_est = BrInscricaoEstadual::Base.new('01.004.823/001-13','AC')
13
+ insc_est.should_not be_valid
14
+ end
15
+
16
+ it "should return erro state not found" do
17
+ expect { BrInscricaoEstadual::Base.new('01.004.823/001-12',:fs) }.to raise_error()
18
+ end
19
+ end
@@ -0,0 +1,16 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ describe BrInscricaoEstadual::CE do
5
+
6
+ it "should valid Ceara states incription" do
7
+ insc_est = BrInscricaoEstadual::CE.new('06000001-5')
8
+ insc_est.should be_valid
9
+ end
10
+
11
+ it "should not valid Ceara states incription" do
12
+ insc_est = BrInscricaoEstadual::CE.new('06000001-4')
13
+ insc_est.should_not be_valid
14
+ end
15
+
16
+ end
@@ -0,0 +1,21 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ describe BrInscricaoEstadual::DF do
5
+
6
+ it "should valid Distrito Federal states incription" do
7
+ insc_est = BrInscricaoEstadual::DF.new('073.000.01/001-09')
8
+ insc_est.should be_valid
9
+ end
10
+
11
+ it "should not valid Distrito Federal states incription" do
12
+ insc_est = BrInscricaoEstadual::DF.new('083.000.01/001-00')
13
+ insc_est.should_not be_valid
14
+ end
15
+
16
+ it "should not valid Distrito Federal states incription" do
17
+ insc_est = BrInscricaoEstadual::DF.new('073.000.01/001-08')
18
+ insc_est.should_not be_valid
19
+ end
20
+
21
+ end
@@ -0,0 +1,16 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ describe BrInscricaoEstadual::ES do
5
+
6
+ it "should valid Espirito Santo states incription" do
7
+ insc_est = BrInscricaoEstadual::ES.new('99999999-0')
8
+ insc_est.should be_valid
9
+ end
10
+
11
+ it "should not valid Espirito Santo states incription" do
12
+ insc_est = BrInscricaoEstadual::ES.new('99999999-1')
13
+ insc_est.should_not be_valid
14
+ end
15
+
16
+ end
@@ -0,0 +1,36 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ describe BrInscricaoEstadual::GO do
5
+
6
+ it "should valid Goias states incription" do
7
+ insc_est = BrInscricaoEstadual::GO.new('10.987.654-7')
8
+ insc_est.should be_valid
9
+ insc_est = BrInscricaoEstadual::GO.new('11094402-0')
10
+ insc_est.should be_valid
11
+ insc_est = BrInscricaoEstadual::GO.new('11094402-1')
12
+ insc_est.should be_valid
13
+ end
14
+
15
+ it "should valid Goias states incription with mod result 0" do
16
+ insc_est = BrInscricaoEstadual::GO.new('11111111-0')
17
+ insc_est.should be_valid
18
+ end
19
+
20
+ it "should valid Goias states incription with mod result 1" do
21
+ insc_est = BrInscricaoEstadual::GO.new('10111110-1')
22
+ insc_est.should be_valid
23
+ end
24
+
25
+ it "should not valid Goias states incription" do
26
+ insc_est = BrInscricaoEstadual::GO.new('09.987.654-7')
27
+ insc_est.should_not be_valid
28
+ end
29
+
30
+
31
+ it "should not valid Goias states incription" do
32
+ insc_est = BrInscricaoEstadual::GO.new('10.987.654-6')
33
+ insc_est.should_not be_valid
34
+ end
35
+
36
+ end
@@ -0,0 +1,16 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ describe BrInscricaoEstadual::MA do
5
+
6
+ it "should valid Maranhao states incription" do
7
+ insc_est = BrInscricaoEstadual::MA.new('120000385')
8
+ insc_est.should be_valid
9
+ end
10
+
11
+ it "should not valid Maranhao states incription" do
12
+ insc_est = BrInscricaoEstadual::MA.new('120000386')
13
+ insc_est.should_not be_valid
14
+ end
15
+
16
+ end
@@ -0,0 +1,16 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ describe BrInscricaoEstadual::MG do
5
+
6
+ it "should valid MINAS GERAIS states incription" do
7
+ insc_est = BrInscricaoEstadual::MG.new('062.307.904/0081')
8
+ insc_est.should be_valid
9
+ end
10
+
11
+ it "should not valid MINAS GERAIS states incription" do
12
+ insc_est = BrInscricaoEstadual::MG.new('062.307.934/0081')
13
+ insc_est.should_not be_valid
14
+ end
15
+
16
+ end
@@ -0,0 +1,16 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ describe BrInscricaoEstadual::MS do
5
+
6
+ it "should valid MATO GROSSO DO SUL states incription" do
7
+ insc_est = BrInscricaoEstadual::MS.new('280000383')
8
+ insc_est.should be_valid
9
+ end
10
+
11
+ it "should not valid MATO GROSSO DO SUL states incription" do
12
+ insc_est = BrInscricaoEstadual::MS.new('120000386')
13
+ insc_est.should_not be_valid
14
+ end
15
+
16
+ end
@@ -0,0 +1,16 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ describe BrInscricaoEstadual::MT do
5
+
6
+ it "should valid Mato Grosso states incription" do
7
+ insc_est = BrInscricaoEstadual::MT.new('0013000001-9')
8
+ insc_est.should be_valid
9
+ end
10
+
11
+ it "should not valid Mato Grosso states incription" do
12
+ insc_est = BrInscricaoEstadual::MT.new('0013000002-9')
13
+ insc_est.should_not be_valid
14
+ end
15
+
16
+ end
@@ -0,0 +1,16 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ describe BrInscricaoEstadual::PA do
5
+
6
+ it "should valid Para states incription" do
7
+ insc_est = BrInscricaoEstadual::PA.new('15-999999-5')
8
+ insc_est.should be_valid
9
+ end
10
+
11
+ it "should not valid Para states incription" do
12
+ insc_est = BrInscricaoEstadual::PA.new('15-999899-5')
13
+ insc_est.should_not be_valid
14
+ end
15
+
16
+ end
@@ -0,0 +1,16 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ describe BrInscricaoEstadual::PB do
5
+
6
+ it "should valid Paraiba states incription" do
7
+ insc_est = BrInscricaoEstadual::PB.new('06000001-5')
8
+ insc_est.should be_valid
9
+ end
10
+
11
+ it "should not valid Paraiba states incription" do
12
+ insc_est = BrInscricaoEstadual::PB.new('06000401-5')
13
+ insc_est.should_not be_valid
14
+ end
15
+
16
+ end
@@ -0,0 +1,16 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ describe BrInscricaoEstadual::PE do
5
+
6
+ it "should valid PERNAMBUCO states incription" do
7
+ insc_est = BrInscricaoEstadual::PE.new('0321418-40')
8
+ insc_est.should be_valid
9
+ end
10
+
11
+ it "should not valid PERNAMBUCO states incription" do
12
+ insc_est = BrInscricaoEstadual::PE.new('0321419-40')
13
+ insc_est.should_not be_valid
14
+ end
15
+
16
+ end
@@ -0,0 +1,16 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ describe BrInscricaoEstadual::PI do
5
+
6
+ it "should valid PIAUI states incription" do
7
+ insc_est = BrInscricaoEstadual::PI.new('0321418-40')
8
+ insc_est.should be_valid
9
+ end
10
+
11
+ it "should not valid PIAUI states incription" do
12
+ insc_est = BrInscricaoEstadual::PI.new('0321419-40')
13
+ insc_est.should_not be_valid
14
+ end
15
+
16
+ end
@@ -0,0 +1,16 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ describe BrInscricaoEstadual::PR do
5
+
6
+ it "should valid Parana states incription" do
7
+ insc_est = BrInscricaoEstadual::PR.new('123.45678-50')
8
+ insc_est.should be_valid
9
+ end
10
+
11
+ it "should not valid Parana states incription" do
12
+ insc_est = BrInscricaoEstadual::PR.new('123.45878-50')
13
+ insc_est.should_not be_valid
14
+ end
15
+
16
+ end
@@ -0,0 +1,16 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ describe BrInscricaoEstadual::RJ do
5
+
6
+ it "should valid Rio de Janeiro states incription" do
7
+ insc_est = BrInscricaoEstadual::RJ.new('99.999.99-3')
8
+ insc_est.should be_valid
9
+ end
10
+
11
+ it "should not valid Rio de Janeiro states incription" do
12
+ insc_est = BrInscricaoEstadual::RJ.new('99.999.99-4')
13
+ insc_est.should_not be_valid
14
+ end
15
+
16
+ end
@@ -0,0 +1,27 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ describe BrInscricaoEstadual::RN do
5
+
6
+ it "should valid RIO GRANDE DO NORTE states incription with size 9" do
7
+ insc_est = BrInscricaoEstadual::RN.new('20.040.040-1')
8
+ insc_est.should be_valid
9
+ end
10
+
11
+ it "should not valid RIO GRANDE DO NORTE states incription with size 9" do
12
+ insc_est = BrInscricaoEstadual::RN.new('20.041.040-1')
13
+ insc_est.should_not be_valid
14
+ end
15
+
16
+
17
+ it "should valid RIO GRANDE DO NORTE states incription with size 10" do
18
+ insc_est = BrInscricaoEstadual::RN.new('20.0.040.040-0')
19
+ insc_est.should be_valid
20
+ end
21
+
22
+ it "should not valid RIO GRANDE DO NORTE states incription with size 10" do
23
+ insc_est = BrInscricaoEstadual::RN.new('20.0.041.040-0')
24
+ insc_est.should_not be_valid
25
+ end
26
+
27
+ end
@@ -0,0 +1,26 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ describe BrInscricaoEstadual::RO do
5
+
6
+ it "should valid Rondonia states incription" do
7
+ insc_est = BrInscricaoEstadual::RO.new('0000000062521-3')
8
+ insc_est.should be_valid
9
+ end
10
+
11
+ it "should not valid Rondonia states incription" do
12
+ insc_est = BrInscricaoEstadual::RO.new('0000000362521-3')
13
+ insc_est.should_not be_valid
14
+ end
15
+
16
+ it "should valid Rondonia states incription with before format 2000" do
17
+ insc_est = BrInscricaoEstadual::RO.new('101.62521-3')
18
+ insc_est.should be_valid
19
+ end
20
+
21
+ it "should not valid Rondonia states incription with before format 2000" do
22
+ insc_est = BrInscricaoEstadual::RO.new('101.62821-3')
23
+ insc_est.should_not be_valid
24
+ end
25
+
26
+ end
@@ -0,0 +1,18 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ describe BrInscricaoEstadual::RR do
5
+
6
+ it "should valid Roraima states incription" do
7
+ %w(24006628-1 24001755-6 24003429-0 24001360-3 24008266-8 24006153-6 24007356-2 24005467-4 24004145-5 24001340-7).each{|insc|
8
+ insc_est = BrInscricaoEstadual::RR.new(insc)
9
+ insc_est.should be_valid
10
+ }
11
+ end
12
+
13
+ it "should not valid Roraima states incription" do
14
+ insc_est = BrInscricaoEstadual::RR.new('240061537')
15
+ insc_est.should_not be_valid
16
+ end
17
+
18
+ end
@@ -0,0 +1,16 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ describe BrInscricaoEstadual::RS do
5
+
6
+ it "should valid Rio Grande do Sul states incription" do
7
+ insc_est = BrInscricaoEstadual::RS.new('224/3658792')
8
+ insc_est.should be_valid
9
+ end
10
+
11
+ it "should not valid Rio Grande do Sul states incription" do
12
+ insc_est = BrInscricaoEstadual::RS.new('223/3658792')
13
+ insc_est.should_not be_valid
14
+ end
15
+
16
+ end
@@ -0,0 +1,16 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ describe BrInscricaoEstadual::SC do
5
+
6
+ it "should valid Santa Catarina states incription" do
7
+ insc_est = BrInscricaoEstadual::SC.new('251.040.852')
8
+ insc_est.should be_valid
9
+ end
10
+
11
+ it "should not valid Santa Catarina states incription" do
12
+ insc_est = BrInscricaoEstadual::SC.new('251.040.853')
13
+ insc_est.should_not be_valid
14
+ end
15
+
16
+ end
@@ -0,0 +1,16 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ describe BrInscricaoEstadual::SE do
5
+
6
+ it "should valid Sergipe states incription" do
7
+ insc_est = BrInscricaoEstadual::SC.new('27123456-3')
8
+ insc_est.should be_valid
9
+ end
10
+
11
+ it "should not valid Sergipe states incription" do
12
+ insc_est = BrInscricaoEstadual::SC.new('27143456-3')
13
+ insc_est.should_not be_valid
14
+ end
15
+
16
+ end
@@ -0,0 +1,25 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ describe BrInscricaoEstadual::SP do
5
+
6
+ it "should valid São Paulo states incription" do
7
+ insc_est = BrInscricaoEstadual::SP.new('110.042.490.114')
8
+ insc_est.should be_valid
9
+ end
10
+
11
+ it "should not valid São Paulo states incription" do
12
+ insc_est = BrInscricaoEstadual::SP.new('110.043.490.114')
13
+ insc_est.should_not be_valid
14
+ end
15
+
16
+ it "should valid São Paulo states incription produtor rural" do
17
+ insc_est = BrInscricaoEstadual::SP.new('P-01100424.3/002')
18
+ insc_est.should be_valid
19
+ end
20
+
21
+ it "should not valid São Paulo states incription produtor rural" do
22
+ insc_est = BrInscricaoEstadual::SP.new('P-01100454.3/002')
23
+ insc_est.should_not be_valid
24
+ end
25
+ end