br_documents 0.0.10 → 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/spec/ie/mt_spec.rb CHANGED
@@ -1,9 +1,10 @@
1
1
  require "spec_helper"
2
+ require_relative "shared_examples_for_to_remove_all_masks"
2
3
 
3
- describe BrDocuments::IE::MT do
4
+ RSpec.describe BrDocuments::IE::MT do
4
5
  describe "#formatted" do
5
6
  it "returns a formatted ie" do
6
- ie = BrDocuments::IE::MT.new("12345678901")
7
+ ie = described_class.new("12345678901")
7
8
  expect(ie.formatted).to eq "1234567890-1"
8
9
  end
9
10
  end
@@ -11,31 +12,33 @@ describe BrDocuments::IE::MT do
11
12
  describe "#valid?" do
12
13
  it "is invalid with malformed number" do
13
14
  ["82.060.187.373", "528843171-72", "AD402552219"].each do |number|
14
- ie = BrDocuments::IE::MT.new(number)
15
+ ie = described_class.new(number)
15
16
  expect(ie).to_not be_valid
16
17
  end
17
18
  end
18
19
 
19
20
  context "when the number is greater than 11" do
20
- subject { BrDocuments::IE::MT.new("123456789012") }
21
+ subject { described_class.new("123456789012") }
21
22
 
22
- it "is invalid " do
23
+ it "is invalid" do
23
24
  expect(subject).to_not be_valid
24
25
  end
25
26
  end
26
27
 
27
28
  it "is invalid with invalid check number" do
28
29
  ["00404609123", "83646580222"].each do |number|
29
- ie = BrDocuments::IE::MT.new(number)
30
+ ie = described_class.new(number)
30
31
  expect(ie).to_not be_valid
31
32
  end
32
33
  end
33
34
 
34
35
  it "is valid with valid number" do
35
36
  ["0013000001-9", "82060187373", "132631946", "13.263.194-6"].each do |number|
36
- ie = BrDocuments::IE::MT.new(number)
37
+ ie = described_class.new(number)
37
38
  expect(ie).to be_valid
38
39
  end
39
40
  end
41
+
42
+ include_examples "for to remove all masks", "0013000001-9"
40
43
  end
41
44
  end
data/spec/ie/pa_spec.rb CHANGED
@@ -1,9 +1,10 @@
1
1
  require "spec_helper"
2
+ require_relative "shared_examples_for_to_remove_all_masks"
2
3
 
3
4
  describe BrDocuments::IE::PA do
4
5
  describe "#formatted" do
5
6
  it "returns a formatted ie" do
6
- ie = BrDocuments::IE::PA.new("123456789")
7
+ ie = described_class.new("123456789")
7
8
  expect(ie.formatted).to eq "12-345678-9"
8
9
  end
9
10
  end
@@ -11,30 +12,32 @@ describe BrDocuments::IE::PA do
11
12
  describe "#valid?" do
12
13
  it "is invalid with malformed number" do
13
14
  ["15.361.802-7", "15-48556-93", "15-4AB752-7"].each do |number|
14
- ie = BrDocuments::IE::PA.new(number)
15
+ ie = described_class.new(number)
15
16
  expect(ie).to_not be_valid
16
17
  end
17
18
  end
18
19
 
19
20
  it "is invalid with length different to 9" do
20
21
  ["1234567", "12345678901"].each do |number|
21
- ie = BrDocuments::IE::PA.new(number)
22
+ ie = described_class.new(number)
22
23
  expect(ie).to_not be_valid
23
24
  end
24
25
  end
25
26
 
26
27
  it "is invalid with invalid check number" do
27
28
  ["152653852", "157252799"].each do |number|
28
- ie = BrDocuments::IE::PA.new(number)
29
+ ie = described_class.new(number)
29
30
  expect(ie).to_not be_valid
30
31
  end
31
32
  end
32
33
 
33
34
  it "is valid with valid number" do
34
35
  ["159636841", "158667794"].each do |number|
35
- ie = BrDocuments::IE::PA.new(number)
36
+ ie = described_class.new(number)
36
37
  expect(ie).to be_valid
37
38
  end
38
39
  end
40
+
41
+ include_examples "for to remove all masks", "15-866779-4"
39
42
  end
40
43
  end
data/spec/ie/pb_spec.rb CHANGED
@@ -1,13 +1,16 @@
1
1
  require "spec_helper"
2
2
  require_relative "shared_examples_for_pattern1"
3
+ require_relative "shared_examples_for_to_remove_all_masks"
3
4
 
4
5
  describe BrDocuments::IE::PB do
5
6
  describe "#formatted" do
6
7
  it "returns a formatted ie" do
7
- ie = BrDocuments::IE::PB.new("123456789")
8
+ ie = described_class.new("123456789")
8
9
  expect(ie.formatted).to eq "12345678-9"
9
10
  end
10
11
  end
11
12
 
12
13
  it_behaves_like "a pattern1", "PB"
14
+
15
+ include_examples "for to remove all masks", "12345678-9"
13
16
  end
data/spec/ie/pe_spec.rb CHANGED
@@ -1,17 +1,18 @@
1
1
  require "spec_helper"
2
+ require_relative "shared_examples_for_to_remove_all_masks"
2
3
 
3
4
  describe BrDocuments::IE::PE do
4
5
  describe "#formatted" do
5
6
  context "when having 9 digits" do
6
7
  it "returns a formatted ie" do
7
- ie = BrDocuments::IE::PE.new("123456789")
8
+ ie = described_class.new("123456789")
8
9
  expect(ie.formatted).to eq "1234567-89"
9
10
  end
10
11
  end
11
12
 
12
13
  context "when having 14 digits" do
13
14
  it "returns a formatted ie" do
14
- ie = BrDocuments::IE::PE.new("18100100000049")
15
+ ie = described_class.new("18100100000049")
15
16
  expect(ie.formatted).to eq "18.1.001.0000004-9"
16
17
  end
17
18
  end
@@ -20,40 +21,42 @@ describe BrDocuments::IE::PE do
20
21
  describe "#valid?" do
21
22
  it "is invalid with malformed number" do
22
23
  ["15711188-1", "3.661.165-41", "3AB8287-00", "18.1.001.000000-49"].each do |number|
23
- ie = BrDocuments::IE::PE.new(number)
24
+ ie = described_class.new(number)
24
25
  expect(ie).to_not be_valid
25
26
  end
26
27
  end
27
28
 
28
29
  it "is invalid with length different to 9 or 14" do
29
30
  ["1234567", "12345678901", "0123456789012345"].each do |number|
30
- ie = BrDocuments::IE::PE.new(number)
31
+ ie = described_class.new(number)
31
32
  expect(ie).to_not be_valid
32
33
  end
33
34
  end
34
35
 
35
36
  context "when having 9 digits" do
36
37
  it "is invalid with invalid check number" do
37
- ie = BrDocuments::IE::PE.new("838872602")
38
+ ie = described_class.new("838872602")
38
39
  expect(ie).to_not be_valid
39
40
  end
40
41
 
41
42
  it "is valid with valid number" do
42
- ie = BrDocuments::IE::PE.new("418873607")
43
+ ie = described_class.new("418873607")
43
44
  expect(ie).to be_valid
44
45
  end
45
46
  end
46
47
 
47
48
  context "when having 14 digits" do
48
49
  it "is invalid with invalid check number" do
49
- ie = BrDocuments::IE::PE.new("18100100000048")
50
+ ie = described_class.new("18100100000048")
50
51
  expect(ie).to_not be_valid
51
52
  end
52
53
 
53
54
  it "is valid with valid number" do
54
- ie = BrDocuments::IE::PE.new("18100100000049")
55
+ ie = described_class.new("18100100000049")
55
56
  expect(ie).to be_valid
56
57
  end
57
58
  end
59
+
60
+ include_examples "for to remove all masks", "18.1.001.0000004-9"
58
61
  end
59
62
  end
data/spec/ie/pi_spec.rb CHANGED
@@ -1,13 +1,16 @@
1
1
  require "spec_helper"
2
2
  require_relative "shared_examples_for_pattern1"
3
+ require_relative "shared_examples_for_to_remove_all_masks"
3
4
 
4
5
  describe BrDocuments::IE::PI do
5
6
  describe "#formatted" do
6
7
  it "returns a formatted ie" do
7
- ie = BrDocuments::IE::PI.new("123456789")
8
+ ie = described_class.new("123456789")
8
9
  expect(ie.formatted).to eq "123456789"
9
10
  end
10
11
  end
11
12
 
12
13
  it_behaves_like "a pattern1", "PI"
14
+
15
+ include_examples "for to remove all masks", "12345678-9"
13
16
  end
data/spec/ie/pr_spec.rb CHANGED
@@ -1,9 +1,10 @@
1
1
  require "spec_helper"
2
+ require_relative "shared_examples_for_to_remove_all_masks"
2
3
 
3
4
  describe BrDocuments::IE::PR do
4
5
  describe "#formatted" do
5
6
  it "returns a formatted ie" do
6
- ie = BrDocuments::IE::PR.new("1234567890")
7
+ ie = described_class.new("1234567890")
7
8
  expect(ie.formatted).to eq "12345678-90"
8
9
  end
9
10
  end
@@ -11,23 +12,25 @@ describe BrDocuments::IE::PR do
11
12
  describe "#valid?" do
12
13
  it "is invalid with malformed number" do
13
14
  ["1016323-850", "10163238.50"].each do |number|
14
- ie = BrDocuments::IE::PR.new(number)
15
+ ie = described_class.new(number)
15
16
  expect(ie).to_not be_valid
16
17
  end
17
18
  end
18
19
 
19
20
  it "is invalid with invalid check number" do
20
21
  ["10163238-51", "10163238-40"].each do |number|
21
- ie = BrDocuments::IE::PR.new(number)
22
+ ie = described_class.new(number)
22
23
  expect(ie).to_not be_valid
23
24
  end
24
25
  end
25
26
 
26
27
  it "is valid with valid number" do
27
28
  ["1016323850", "10163238-50"].each do |number|
28
- ie = BrDocuments::IE::PR.new(number)
29
+ ie = described_class.new(number)
29
30
  expect(ie).to be_valid
30
31
  end
31
32
  end
33
+
34
+ include_examples "for to remove all masks", "10163238-50"
32
35
  end
33
36
  end
data/spec/ie/rj_spec.rb CHANGED
@@ -1,9 +1,10 @@
1
1
  require "spec_helper"
2
+ require_relative "shared_examples_for_to_remove_all_masks"
2
3
 
3
4
  describe BrDocuments::IE::RJ do
4
5
  describe "#formatted" do
5
6
  it "returns a formatted ie" do
6
- ie = BrDocuments::IE::RJ.new("12345678")
7
+ ie = described_class.new("12345678")
7
8
  expect(ie.formatted).to eq "12.345.67-8"
8
9
  end
9
10
  end
@@ -11,30 +12,32 @@ describe BrDocuments::IE::RJ do
11
12
  describe "#valid?" do
12
13
  it "is invalid with malformed number" do
13
14
  ["00.55.55.25", "34.09.25-08", "0A220C18"].each do |number|
14
- ie = BrDocuments::IE::RJ.new(number)
15
+ ie = described_class.new(number)
15
16
  expect(ie).to_not be_valid
16
17
  end
17
18
  end
18
19
 
19
20
  it "is invalid with length different to 8" do
20
21
  ["1234567890", "12345"].each do |number|
21
- ie = BrDocuments::IE::RJ.new(number)
22
+ ie = described_class.new(number)
22
23
  expect(ie).to_not be_valid
23
24
  end
24
25
  end
25
26
 
26
27
  it "is invalid with invalid check number" do
27
28
  ["99228676", "48388923"].each do |number|
28
- ie = BrDocuments::IE::RJ.new(number)
29
+ ie = described_class.new(number)
29
30
  expect(ie).to_not be_valid
30
31
  end
31
32
  end
32
33
 
33
34
  it "is valid with valid number" do
34
35
  ["80172010", "31.864.95-0", "85.994.964"].each do |number|
35
- ie = BrDocuments::IE::RJ.new(number)
36
+ ie = described_class.new(number)
36
37
  expect(ie).to be_valid
37
38
  end
38
39
  end
40
+
41
+ include_examples "for to remove all masks", "31.864.95-0"
39
42
  end
40
43
  end
data/spec/ie/rn_spec.rb CHANGED
@@ -1,17 +1,18 @@
1
1
  require "spec_helper"
2
+ require_relative "shared_examples_for_to_remove_all_masks"
2
3
 
3
4
  describe BrDocuments::IE::RN do
4
5
  describe "#formatted" do
5
6
  context "when having 9 digits" do
6
7
  it "returns a formatted ie" do
7
- ie = BrDocuments::IE::RN.new("123456789")
8
+ ie = described_class.new("123456789")
8
9
  expect(ie.formatted).to eq "12.345.678-9"
9
10
  end
10
11
  end
11
12
 
12
13
  context "when having 10 digits" do
13
14
  it "returns a formatted ie" do
14
- ie = BrDocuments::IE::RN.new("1234567890")
15
+ ie = described_class.new("1234567890")
15
16
  expect(ie.formatted).to eq "12.3.456.789-0"
16
17
  end
17
18
  end
@@ -20,40 +21,42 @@ describe BrDocuments::IE::RN do
20
21
  describe "#valid?" do
21
22
  it "is invalid with malformed number" do
22
23
  ["9.012.207-95", "617.964.80-7", "25.9AB.924-6"].each do |number|
23
- ie = BrDocuments::IE::RN.new(number)
24
+ ie = described_class.new(number)
24
25
  expect(ie).to_not be_valid
25
26
  end
26
27
  end
27
28
 
28
29
  it "is invalid with length different to 9 or 10" do
29
30
  ["12345678", "12345678901"].each do |number|
30
- ie = BrDocuments::IE::RN.new(number)
31
+ ie = described_class.new(number)
31
32
  expect(ie).to_not be_valid
32
33
  end
33
34
  end
34
35
 
35
36
  context "when having 9 digits" do
36
37
  it "is invalid with invalid check number" do
37
- ie = BrDocuments::IE::RN.new("794050643")
38
+ ie = described_class.new("794050643")
38
39
  expect(ie).to_not be_valid
39
40
  end
40
41
 
41
42
  it "is valid with valid number" do
42
- ie = BrDocuments::IE::RN.new("200400401")
43
+ ie = described_class.new("200400401")
43
44
  expect(ie).to be_valid
44
45
  end
45
46
  end
46
47
 
47
48
  context "when having 10 digits" do
48
49
  it "is invalid with invalid check number" do
49
- ie = BrDocuments::IE::RN.new("1153296142")
50
+ ie = described_class.new("1153296142")
50
51
  expect(ie).to_not be_valid
51
52
  end
52
53
 
53
54
  it "is valid with valid number" do
54
- ie = BrDocuments::IE::RN.new("2000400400")
55
+ ie = described_class.new("2000400400")
55
56
  expect(ie).to be_valid
56
57
  end
57
58
  end
59
+
60
+ include_examples "for to remove all masks", "20.0.040.040-0"
58
61
  end
59
62
  end
data/spec/ie/ro_spec.rb CHANGED
@@ -1,17 +1,18 @@
1
1
  require "spec_helper"
2
+ require_relative "shared_examples_for_to_remove_all_masks"
2
3
 
3
4
  describe BrDocuments::IE::RO do
4
5
  describe "#formatted" do
5
6
  context "when having 9 digits" do
6
7
  it "returns a formatted ie" do
7
- ie = BrDocuments::IE::RO.new("123456789")
8
+ ie = described_class.new("123456789")
8
9
  expect(ie.formatted).to eq "123.45678-9"
9
10
  end
10
11
  end
11
12
 
12
13
  context "when having 14 digits" do
13
14
  it "returns a formatted ie" do
14
- ie = BrDocuments::IE::RO.new("12345678901234")
15
+ ie = described_class.new("12345678901234")
15
16
  expect(ie.formatted).to eq "1234567890123-4"
16
17
  end
17
18
  end
@@ -20,40 +21,42 @@ describe BrDocuments::IE::RO do
20
21
  describe "#valid?" do
21
22
  it "is invalid with malformed number" do
22
23
  ["20.049.788-6", "2.004.978-86", "937.03AB1-6"].each do |number|
23
- ie = BrDocuments::IE::RO.new(number)
24
+ ie = described_class.new(number)
24
25
  expect(ie).to_not be_valid
25
26
  end
26
27
  end
27
28
 
28
29
  it "is invalid with length different to 9 or 14" do
29
30
  ["1234567", "123456789012", "12345678901234567"].each do |number|
30
- ie = BrDocuments::IE::RO.new(number)
31
+ ie = described_class.new(number)
31
32
  expect(ie).to_not be_valid
32
33
  end
33
34
  end
34
35
 
35
36
  context "when having 9 digits" do
36
37
  it "is invalid with invalid check number" do
37
- ie = BrDocuments::IE::RO.new("134725252")
38
+ ie = described_class.new("134725252")
38
39
  expect(ie).to_not be_valid
39
40
  end
40
41
 
41
42
  it "is valid with valid number" do
42
- ie = BrDocuments::IE::RO.new("101625213")
43
+ ie = described_class.new("101625213")
43
44
  expect(ie).to be_valid
44
45
  end
45
46
  end
46
47
 
47
48
  context "when having 14 digits" do
48
49
  it "is invalid with invalid check number" do
49
- ie = BrDocuments::IE::RO.new("02539835229263")
50
+ ie = described_class.new("02539835229263")
50
51
  expect(ie).to_not be_valid
51
52
  end
52
53
 
53
54
  it "is valid with valid number" do
54
- ie = BrDocuments::IE::RO.new("00000000625213")
55
+ ie = described_class.new("00000000625213")
55
56
  expect(ie).to be_valid
56
57
  end
57
58
  end
59
+
60
+ include_examples "for to remove all masks", "0000000062521-3"
58
61
  end
59
62
  end
data/spec/ie/rr_spec.rb CHANGED
@@ -1,9 +1,10 @@
1
1
  require "spec_helper"
2
+ require_relative "shared_examples_for_to_remove_all_masks"
2
3
 
3
4
  describe BrDocuments::IE::RR do
4
5
  describe "#formatted" do
5
6
  it "returns a formatted ie" do
6
- ie = BrDocuments::IE::RR.new("123456789")
7
+ ie = described_class.new("123456789")
7
8
  expect(ie.formatted).to eq "12345678-9"
8
9
  end
9
10
  end
@@ -11,30 +12,32 @@ describe BrDocuments::IE::RR do
11
12
  describe "#valid?" do
12
13
  it "is invalid with malformed number" do
13
14
  ["24.410.109-5", "2456128-32", "24AB0559-6"].each do |number|
14
- ie = BrDocuments::IE::RR.new(number)
15
+ ie = described_class.new(number)
15
16
  expect(ie).to_not be_valid
16
17
  end
17
18
  end
18
19
 
19
20
  it "is invalid with length different to 9" do
20
21
  ["1234567", "123456789"].each do |number|
21
- ie = BrDocuments::IE::RR.new(number)
22
+ ie = described_class.new(number)
22
23
  expect(ie).to_not be_valid
23
24
  end
24
25
  end
25
26
 
26
27
  it "is invalid with invalid check number" do
27
28
  ["242131962", "247318099"].each do |number|
28
- ie = BrDocuments::IE::RR.new(number)
29
+ ie = described_class.new(number)
29
30
  expect(ie).to_not be_valid
30
31
  end
31
32
  end
32
33
 
33
34
  it "is valid with valid number" do
34
35
  ["241432573", "240886456"].each do |number|
35
- ie = BrDocuments::IE::RR.new(number)
36
+ ie = described_class.new(number)
36
37
  expect(ie).to be_valid
37
38
  end
38
39
  end
40
+
41
+ include_examples "for to remove all masks", "24088645-6"
39
42
  end
40
43
  end
data/spec/ie/rs_spec.rb CHANGED
@@ -1,38 +1,41 @@
1
1
  require "spec_helper"
2
+ require_relative "shared_examples_for_to_remove_all_masks"
2
3
 
3
4
  describe BrDocuments::IE::RS do
4
5
  describe "#formatted" do
5
6
  it "returns a formatted ie" do
6
- ie = BrDocuments::IE::RS.new("1234567890")
7
+ ie = described_class.new("1234567890")
7
8
  expect(ie.formatted).to eq "123/4567890"
8
9
  end
9
10
  end
10
11
 
11
12
  describe "#valid?" do
12
13
  it "is invalid with malformed number" do
13
- ie = BrDocuments::IE::RS.new("17/70169293")
14
+ ie = described_class.new("17/70169293")
14
15
  expect(ie).to_not be_valid
15
16
  end
16
17
 
17
18
  it "is invalid with length different to 10" do
18
19
  ["123456789", "12345678901"].each do |number|
19
- ie = BrDocuments::IE::RS.new(number)
20
+ ie = described_class.new(number)
20
21
  expect(ie).to_not be_valid
21
22
  end
22
23
  end
23
24
 
24
25
  it "is invalid with invalid check number" do
25
26
  ["1770169292", "034/0112114"].each do |number|
26
- ie = BrDocuments::IE::RS.new(number)
27
+ ie = described_class.new(number)
27
28
  expect(ie).to_not be_valid
28
29
  end
29
30
  end
30
31
 
31
32
  it "is valid with valid number" do
32
33
  ["1770169293", "034/0112115"].each do |number|
33
- ie = BrDocuments::IE::RS.new(number)
34
+ ie = described_class.new(number)
34
35
  expect(ie).to be_valid
35
36
  end
36
37
  end
38
+
39
+ include_examples "for to remove all masks", "034/0112115"
37
40
  end
38
41
  end
data/spec/ie/sc_spec.rb CHANGED
@@ -1,9 +1,10 @@
1
1
  require "spec_helper"
2
+ require_relative "shared_examples_for_to_remove_all_masks"
2
3
 
3
4
  describe BrDocuments::IE::SC do
4
5
  describe "#formatted" do
5
6
  it "returns a formatted ie" do
6
- ie = BrDocuments::IE::SC.new("123456789")
7
+ ie = described_class.new("123456789")
7
8
  expect(ie.formatted).to eq "123.456.789"
8
9
  end
9
10
  end
@@ -11,30 +12,32 @@ describe BrDocuments::IE::SC do
11
12
  describe "#valid?" do
12
13
  it "is invalid with malformed number" do
13
14
  ["253.66.7852", "25.4062.407", "A12345678"].each do |number|
14
- ie = BrDocuments::IE::SC.new(number)
15
+ ie = described_class.new(number)
15
16
  expect(ie).to_not be_valid
16
17
  end
17
18
  end
18
19
 
19
20
  it "is invalid with length different to 9" do
20
21
  ["1234567890", "12345678"].each do |number|
21
- ie = BrDocuments::IE::SC.new(number)
22
+ ie = described_class.new(number)
22
23
  expect(ie).to_not be_valid
23
24
  end
24
25
  end
25
26
 
26
27
  it "is invalid with invalid check number" do
27
28
  ["253667853", "254.062.408"].each do |number|
28
- ie = BrDocuments::IE::SC.new(number)
29
+ ie = described_class.new(number)
29
30
  expect(ie).to_not be_valid
30
31
  end
31
32
  end
32
33
 
33
34
  it "is valid with valid number" do
34
35
  ["253667852", "254.062.407"].each do |number|
35
- ie = BrDocuments::IE::SC.new(number)
36
+ ie = described_class.new(number)
36
37
  expect(ie).to be_valid
37
38
  end
38
39
  end
40
+
41
+ include_examples "for to remove all masks", "254.062.407"
39
42
  end
40
43
  end
data/spec/ie/se_spec.rb CHANGED
@@ -1,13 +1,16 @@
1
1
  require "spec_helper"
2
2
  require_relative "shared_examples_for_pattern1"
3
+ require_relative "shared_examples_for_to_remove_all_masks"
3
4
 
4
5
  describe BrDocuments::IE::SE do
5
6
  describe "#formatted" do
6
7
  it "returns a formatted ie" do
7
- ie = BrDocuments::IE::SE.new("123456789")
8
+ ie = described_class.new("123456789")
8
9
  expect(ie.formatted).to eq "12345678-9"
9
10
  end
10
11
  end
11
12
 
12
13
  it_behaves_like "a pattern1", "SE"
14
+
15
+ include_examples "for to remove all masks", "12345678-9"
13
16
  end
@@ -1,31 +1,31 @@
1
1
  require "spec_helper"
2
2
 
3
3
  shared_examples "a pattern1" do |uf|
4
- describe "#valid?" do
4
+ describe BrDocuments::IE::Factory, "#valid?" do
5
5
  it "is invalid with malformed number" do
6
6
  ["1922212-21", "72.219.398-0", "63BA9943-8"].each do |number|
7
- ie = BrDocuments::IE::Factory.create(uf, number)
7
+ ie = described_class.create(uf, number)
8
8
  expect(ie).to_not be_valid
9
9
  end
10
10
  end
11
11
 
12
12
  it "is invalid with length different to 9" do
13
13
  ["1234567", "12345678901"].each do |number|
14
- ie = BrDocuments::IE::Factory.create(uf, number)
14
+ ie = described_class.create(uf, number)
15
15
  expect(ie).to_not be_valid
16
16
  end
17
17
  end
18
18
 
19
19
  it "is invalid with invalid check number" do
20
20
  ["226905727", "662637732"].each do |number|
21
- ie = BrDocuments::IE::Factory.create(uf, number)
21
+ ie = described_class.create(uf, number)
22
22
  expect(ie).to_not be_valid
23
23
  end
24
24
  end
25
25
 
26
26
  it "is valid with valid number" do
27
27
  ["732766940", "665822081"].each do |number|
28
- ie = BrDocuments::IE::Factory.create(uf, number)
28
+ ie = described_class.create(uf, number)
29
29
  expect(ie).to be_valid
30
30
  end
31
31
  end
@@ -0,0 +1,17 @@
1
+ require "spec_helper"
2
+
3
+ shared_examples "for to remove all masks" do |valid_number_with_mask|
4
+ describe "#valid?" do
5
+
6
+ context "when the number is valid" do
7
+ subject { described_class.new(valid_number_with_mask) }
8
+
9
+ it "removes the mask" do
10
+ expect(subject).to be_valid
11
+
12
+ only_numbers = valid_number_with_mask.gsub(/[\.\/-]/, "")
13
+ expect(valid_number_with_mask).to eq only_numbers
14
+ end
15
+ end
16
+ end
17
+ end