br_danfe 0.0.8 → 0.0.9

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b11c5123d9152fc5cffd2df72c3bd141ba2c3bf4
4
- data.tar.gz: 6d5ef282d19d7f55bbc8ef19a5baac655f0560cf
3
+ metadata.gz: 8ef778a09a4e83800cce83668b534ec0175a1a93
4
+ data.tar.gz: 064e8583d023106ec7ee027f4b8ee3a723d6de3f
5
5
  SHA512:
6
- metadata.gz: c3885dd21885dcc2e1f9ea5988b222c8161802c0cce93e7f63ce5be8a464e76c07771046ca906ae45de50b51c9a6048a6373f87aec2dd8dd58e1add487d45c51
7
- data.tar.gz: 5cd590428cab4cd3d8e0dd4e1725c9c8900634f206fd52461e0fdcf02818572d36519289cdafcd1b092f299f69b97966f22f86873f64e93ff18f66e2a199dc83
6
+ metadata.gz: 4320de3465acd3d64ffe433aad431e5ebd7dc142a38235ba3610cc3cddb358cfd03885c5721eea9e4f32bc1535c58f543ade41569623d858da9f49f52fc02613
7
+ data.tar.gz: 0b1694491477d599e375a46df0a581b64d358c0273ef4c265a5d87869f0258362ea73170e96c3d10b4864d5048a7379b1a13f7b302a05b02d11ec0f189244022
data/README.md CHANGED
@@ -59,44 +59,21 @@ You can install all necessaries dependencies using bunder like above:
59
59
 
60
60
  ### Tests
61
61
 
62
- #### Manual tests
63
-
64
- You can use it following the steps above:
65
-
66
- $ rake pdf_from["spec/fixtures/nfe_with_ns.xml","./output.pdf"]
67
-
68
- You can also use an special version of irb with all classes pre-loaded. Just use:
69
-
70
- $ rake console
71
-
72
- I18n.locale = "pt-BR"
73
-
74
- xml = File.read "test/nfe_with_ns.xml"
75
-
76
- danfe = BrDanfe::Danfe.new(xml)
77
- danfe.save_pdf "output.pdf"
78
-
79
62
  #### Automated tests with RSpec
80
63
 
81
64
  You can run all specs using:
82
65
 
83
66
  $ rspec
84
67
 
85
- In the `spec/fixtures` folder, you are going to find some xml files. Each one represent a different NF-e context.
86
-
87
- Each xml file must have its respective pdf file.
88
-
89
- If you did some change that caused general visual changes at output pdfs, so you have to rebuild all fixtures pdf files.
90
-
91
- You can do this automagically running the following taks:
68
+ If you modify something that caused general visual changes at output pdfs, so you have to rebuild the fixtures pdf files.
92
69
 
93
- $ rake spec:fixtures:recreate_pdfs
70
+ You can do this simply deleting the fixture pdf file. The `have_same_content_of` matcher will recreate the fixture in the next time you run the `rspec` command.
94
71
 
95
72
  #### Code coverage
96
73
 
97
74
  Code coverage is available through of SimpleCov. Just run `rspec` and open the coverage report in your browser.
98
75
 
99
- #### Generating new fixtures
76
+ #### Fake data for generating new fixtures
100
77
 
101
78
  If you need to generate new danfes for using as fixtures, please don't use real data.
102
79
 
data/Rakefile CHANGED
@@ -4,43 +4,3 @@ require "br_danfe"
4
4
 
5
5
  task default: :spec
6
6
  RSpec::Core::RakeTask.new
7
-
8
- I18n.locale = "pt-BR"
9
-
10
- desc "Open an irb session preloaded BrDanfe classes"
11
- task :console do
12
- sh "irb -rubygems -I lib -r br_danfe.rb"
13
- end
14
-
15
- desc "Generate a pdf from a xml file"
16
- task :pdf_from, :source_xml, :target_pdf do |t, args|
17
- xml_file = args[:source_xml]
18
- pdf_file = args[:target_pdf] || xml_file + ".pdf"
19
-
20
- puts "\n\n\n"
21
- puts "Reading #{xml_file}"
22
- puts "Creating #{pdf_file}"
23
-
24
- BrDanfe.generate("#{pdf_file}", "#{xml_file}")
25
-
26
- puts "File #{pdf_file} created successfully\n\n\n"
27
- end
28
-
29
- namespace :spec do
30
- namespace :fixtures do
31
- desc "Recreate all pdfs fixtures. Use this task always that output pdf format is changed."
32
- task :recreate_pdfs do
33
- Dir["spec/fixtures/nfe*.xml"].each do |f|
34
- puts "Recreating #{f}.fixture.pdf"
35
-
36
- if File.exist?("#{f}.logo.png")
37
- BrDanfe.options.logo_path = "#{f}.logo.png"
38
- else
39
- BrDanfe.options.logo_path = ""
40
- end
41
-
42
- BrDanfe.generate("#{f}.fixture.pdf", "#{f}")
43
- end
44
- end
45
- end
46
- end
@@ -1,3 +1,3 @@
1
1
  module BrDanfe
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
data/lib/br_danfe/vol.rb CHANGED
@@ -17,6 +17,8 @@ module BrDanfe
17
17
  render_vol(det) if nVol < 2
18
18
  end
19
19
 
20
+ render_blank_boxes if nVol == 0
21
+
20
22
  nVol
21
23
  end
22
24
 
@@ -29,5 +31,9 @@ module BrDanfe
29
31
  @pdf.inumeric 0.85, 3.43, 14.10, @l1, "vol.pesoB", det.css("pesoB").text, { decimals: 3 }
30
32
  @pdf.inumeric 0.85, 3.30, 17.53, @l1, "vol.pesoL", det.css("pesoL").text, { decimals: 3 }
31
33
  end
34
+
35
+ def render_blank_boxes
36
+ render_vol(@xml)
37
+ end
32
38
  end
33
39
  end
@@ -0,0 +1,85 @@
1
+ require "spec_helper"
2
+
3
+ describe BrDanfe::Danfe do
4
+ let(:output_pdf) { "#{base_dir}output.pdf" }
5
+
6
+ describe "#render_pdf" do
7
+ let(:base_dir) { "./spec/fixtures/v3.10/"}
8
+
9
+ it "renders a Simples Nacional NF-e using CSOSN" do
10
+ danfe = BrDanfe::Danfe.new(File.read("#{base_dir}nfe_simples_nacional.xml"))
11
+
12
+ expected = IO.binread("#{base_dir}nfe_simples_nacional.xml.fixture.pdf")
13
+
14
+ expect(danfe.render_pdf).to eq expected
15
+ end
16
+ end
17
+
18
+ describe "#save_pdf" do
19
+ context "when xml's version is v2.00" do
20
+ let(:base_dir) { "./spec/fixtures/v2.00/"}
21
+
22
+ before { File.delete(output_pdf) if File.exist?(output_pdf) }
23
+
24
+ it "renders a basic NF-e with namespace" do
25
+ expect(File.exist?(output_pdf)).to be_falsey
26
+
27
+ danfe = BrDanfe::Danfe.new(File.read("#{base_dir}nfe_with_ns.xml"))
28
+ danfe.save_pdf output_pdf
29
+
30
+ expect("#{base_dir}nfe_with_ns.xml.fixture.pdf").to have_same_content_of file: output_pdf
31
+ end
32
+
33
+ it "renders another basic NF-e without namespace" do
34
+ expect(File.exist?(output_pdf)).to be_falsey
35
+
36
+ danfe = BrDanfe::Danfe.new(File.read("#{base_dir}nfe_without_ns.xml"))
37
+ danfe.save_pdf output_pdf
38
+
39
+ expect("#{base_dir}nfe_without_ns.xml.fixture.pdf").to have_same_content_of file: output_pdf
40
+ end
41
+
42
+ it "renders a NF-e having FCI in its items" do
43
+ expect(File.exist?(output_pdf)).to be_falsey
44
+
45
+ danfe = BrDanfe::Danfe.new(File.read("#{base_dir}nfe_with_fci.xml"))
46
+ danfe.save_pdf output_pdf
47
+
48
+ expect("#{base_dir}nfe_with_fci.xml.fixture.pdf").to have_same_content_of file: output_pdf
49
+ end
50
+
51
+ it "renders a Simples Nacional NF-e using CSOSN" do
52
+ expect(File.exist?(output_pdf)).to be_falsey
53
+
54
+ danfe = BrDanfe::Danfe.new(File.read("#{base_dir}nfe_simples_nacional.xml"))
55
+ danfe.save_pdf output_pdf
56
+
57
+ expect("#{base_dir}nfe_simples_nacional.xml.fixture.pdf").to have_same_content_of file: output_pdf
58
+ end
59
+
60
+ it "renders a NF-e with extra volumes" do
61
+ expect(File.exist?(output_pdf)).to be_falsey
62
+
63
+ danfe = BrDanfe::Danfe.new(File.read("#{base_dir}nfe_with_extra_volumes.xml"))
64
+ danfe.save_pdf output_pdf
65
+
66
+ expect("#{base_dir}nfe_with_extra_volumes.xml.fixture.pdf").to have_same_content_of file: output_pdf
67
+ end
68
+ end
69
+
70
+ context "when xml's version is v3.10" do
71
+ let(:base_dir) { "./spec/fixtures/v3.10/"}
72
+
73
+ before { File.delete(output_pdf) if File.exist?(output_pdf) }
74
+
75
+ it "renders a Simples Nacional NF-e using CSOSN" do
76
+ expect(File.exist?(output_pdf)).to be_falsey
77
+
78
+ danfe = BrDanfe::Danfe.new(File.read("#{base_dir}nfe_simples_nacional.xml"))
79
+ danfe.save_pdf output_pdf
80
+
81
+ expect("#{base_dir}nfe_simples_nacional.xml.fixture.pdf").to have_same_content_of file: output_pdf
82
+ end
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,117 @@
1
+ %PDF-1.3
2
+ %����
3
+ 1 0 obj
4
+ << /Creator <feff0050007200610077006e>
5
+ /Producer <feff0050007200610077006e>
6
+ >>
7
+ endobj
8
+ 2 0 obj
9
+ << /Type /Catalog
10
+ /Pages 3 0 R
11
+ >>
12
+ endobj
13
+ 3 0 obj
14
+ << /Type /Pages
15
+ /Count 1
16
+ /Kids [5 0 R]
17
+ >>
18
+ endobj
19
+ 4 0 obj
20
+ << /Length 777
21
+ >>
22
+ stream
23
+ q
24
+ 0.3 w
25
+ 7.087 355.181 82.772 24.094 re
26
+ S
27
+
28
+ BT
29
+ 9.086614173228348 373.17759055118114 Td
30
+ /F1.0 6 Tf
31
+ [<51> 10 <55> 40 <414e544944> 40 <414445>] TJ
32
+ ET
33
+
34
+ 89.858 355.181 86.457 24.094 re
35
+ S
36
+
37
+ BT
38
+ 91.85826771653544 373.17759055118114 Td
39
+ /F1.0 6 Tf
40
+ [<455350c9434945>] TJ
41
+ ET
42
+
43
+ 176.315 355.181 86.457 24.094 re
44
+ S
45
+
46
+ BT
47
+ 178.31496062992127 373.17759055118114 Td
48
+ /F1.0 6 Tf
49
+ [<4d41524341>] TJ
50
+ ET
51
+
52
+ 262.772 355.181 136.913 24.094 re
53
+ S
54
+
55
+ BT
56
+ 264.7716535433071 373.17759055118114 Td
57
+ /F1.0 6 Tf
58
+ [<4e554d455241> 40 <c7c3> 55 <4f>] TJ
59
+ ET
60
+
61
+ 399.685 355.181 97.228 24.094 re
62
+ S
63
+
64
+ BT
65
+ 401.68503937007875 373.17759055118114 Td
66
+ /F1.0 6 Tf
67
+ [<5045534f204252> 40 <5554> 18 <4f>] TJ
68
+ ET
69
+
70
+ 496.913 355.181 93.543 24.094 re
71
+ S
72
+
73
+ BT
74
+ 498.91338582677173 373.17759055118114 Td
75
+ /F1.0 6 Tf
76
+ [<5045534f204ccd51> 10 <5549444f>] TJ
77
+ ET
78
+
79
+ Q
80
+
81
+ endstream
82
+ endobj
83
+ 5 0 obj
84
+ << /Type /Page
85
+ /Parent 3 0 R
86
+ /MediaBox [0 0 595.28 841.89]
87
+ /Contents 4 0 R
88
+ /Resources << /ProcSet [/PDF /Text /ImageB /ImageC /ImageI]
89
+ /Font << /F1.0 6 0 R
90
+ >>
91
+ >>
92
+ >>
93
+ endobj
94
+ 6 0 obj
95
+ << /Type /Font
96
+ /Subtype /Type1
97
+ /BaseFont /Times-Roman
98
+ /Encoding /WinAnsiEncoding
99
+ >>
100
+ endobj
101
+ xref
102
+ 0 7
103
+ 0000000000 65535 f
104
+ 0000000015 00000 n
105
+ 0000000109 00000 n
106
+ 0000000158 00000 n
107
+ 0000000215 00000 n
108
+ 0000001043 00000 n
109
+ 0000001223 00000 n
110
+ trailer
111
+ << /Size 7
112
+ /Root 2 0 R
113
+ /Info 1 0 R
114
+ >>
115
+ startxref
116
+ 1322
117
+ %%EOF
@@ -672,7 +672,7 @@ endobj
672
672
  /F3.0 10 0 R
673
673
  >>
674
674
  >>
675
- /Length 17167
675
+ /Length 17934
676
676
  >>
677
677
  stream
678
678
  q
@@ -1620,6 +1620,60 @@ BT
1620
1620
  [<494e53435249c7c2> 55 <4f20455354> 93 <414455> 40 <414c>] TJ
1621
1621
  ET
1622
1622
 
1623
+ 7.087 355.181 82.772 24.094 re
1624
+ S
1625
+
1626
+ BT
1627
+ 9.086614173228348 373.17759055118114 Td
1628
+ /F1.0 6 Tf
1629
+ [<51> 10 <55> 40 <414e544944> 40 <414445>] TJ
1630
+ ET
1631
+
1632
+ 89.858 355.181 86.457 24.094 re
1633
+ S
1634
+
1635
+ BT
1636
+ 91.85826771653544 373.17759055118114 Td
1637
+ /F1.0 6 Tf
1638
+ [<455350c9434945>] TJ
1639
+ ET
1640
+
1641
+ 176.315 355.181 86.457 24.094 re
1642
+ S
1643
+
1644
+ BT
1645
+ 178.31496062992127 373.17759055118114 Td
1646
+ /F1.0 6 Tf
1647
+ [<4d41524341>] TJ
1648
+ ET
1649
+
1650
+ 262.772 355.181 136.913 24.094 re
1651
+ S
1652
+
1653
+ BT
1654
+ 264.7716535433071 373.17759055118114 Td
1655
+ /F1.0 6 Tf
1656
+ [<4e554d455241> 40 <c7c3> 55 <4f>] TJ
1657
+ ET
1658
+
1659
+ 399.685 355.181 97.228 24.094 re
1660
+ S
1661
+
1662
+ BT
1663
+ 401.68503937007875 373.17759055118114 Td
1664
+ /F1.0 6 Tf
1665
+ [<5045534f204252> 40 <5554> 18 <4f>] TJ
1666
+ ET
1667
+
1668
+ 496.913 355.181 93.543 24.094 re
1669
+ S
1670
+
1671
+ BT
1672
+ 498.91338582677173 373.17759055118114 Td
1673
+ /F1.0 6 Tf
1674
+ [<5045534f204ccd51> 10 <5549444f>] TJ
1675
+ ET
1676
+
1623
1677
 
1624
1678
  BT
1625
1679
  7.086614173228347 344.29977952755917 Td
@@ -1866,13 +1920,13 @@ xref
1866
1920
  0000007670 00000 n
1867
1921
  0000008188 00000 n
1868
1922
  0000008287 00000 n
1869
- 0000025629 00000 n
1870
- 0000025727 00000 n
1923
+ 0000026396 00000 n
1924
+ 0000026494 00000 n
1871
1925
  trailer
1872
1926
  << /Size 11
1873
1927
  /Root 2 0 R
1874
1928
  /Info 1 0 R
1875
1929
  >>
1876
1930
  startxref
1877
- 25828
1931
+ 26595
1878
1932
  %%EOF
@@ -1610,7 +1610,7 @@ endobj
1610
1610
  /F3.0 10 0 R
1611
1611
  >>
1612
1612
  >>
1613
- /Length 16655
1613
+ /Length 17422
1614
1614
  >>
1615
1615
  stream
1616
1616
  q
@@ -2460,6 +2460,60 @@ BT
2460
2460
  [<494e53435249c7c2> 55 <4f20455354> 93 <414455> 40 <414c>] TJ
2461
2461
  ET
2462
2462
 
2463
+ 7.087 355.181 82.772 24.094 re
2464
+ S
2465
+
2466
+ BT
2467
+ 9.086614173228348 373.17759055118114 Td
2468
+ /F1.0 6 Tf
2469
+ [<51> 10 <55> 40 <414e544944> 40 <414445>] TJ
2470
+ ET
2471
+
2472
+ 89.858 355.181 86.457 24.094 re
2473
+ S
2474
+
2475
+ BT
2476
+ 91.85826771653544 373.17759055118114 Td
2477
+ /F1.0 6 Tf
2478
+ [<455350c9434945>] TJ
2479
+ ET
2480
+
2481
+ 176.315 355.181 86.457 24.094 re
2482
+ S
2483
+
2484
+ BT
2485
+ 178.31496062992127 373.17759055118114 Td
2486
+ /F1.0 6 Tf
2487
+ [<4d41524341>] TJ
2488
+ ET
2489
+
2490
+ 262.772 355.181 136.913 24.094 re
2491
+ S
2492
+
2493
+ BT
2494
+ 264.7716535433071 373.17759055118114 Td
2495
+ /F1.0 6 Tf
2496
+ [<4e554d455241> 40 <c7c3> 55 <4f>] TJ
2497
+ ET
2498
+
2499
+ 399.685 355.181 97.228 24.094 re
2500
+ S
2501
+
2502
+ BT
2503
+ 401.68503937007875 373.17759055118114 Td
2504
+ /F1.0 6 Tf
2505
+ [<5045534f204252> 40 <5554> 18 <4f>] TJ
2506
+ ET
2507
+
2508
+ 496.913 355.181 93.543 24.094 re
2509
+ S
2510
+
2511
+ BT
2512
+ 498.91338582677173 373.17759055118114 Td
2513
+ /F1.0 6 Tf
2514
+ [<5045534f204ccd51> 10 <5549444f>] TJ
2515
+ ET
2516
+
2463
2517
 
2464
2518
  BT
2465
2519
  7.086614173228347 344.29977952755917 Td
@@ -2720,13 +2774,13 @@ xref
2720
2774
  0000019324 00000 n
2721
2775
  0000019842 00000 n
2722
2776
  0000019941 00000 n
2723
- 0000036771 00000 n
2724
- 0000036869 00000 n
2777
+ 0000037538 00000 n
2778
+ 0000037636 00000 n
2725
2779
  trailer
2726
2780
  << /Size 11
2727
2781
  /Root 2 0 R
2728
2782
  /Info 1 0 R
2729
2783
  >>
2730
2784
  startxref
2731
- 36970
2785
+ 37737
2732
2786
  %%EOF
@@ -52,7 +52,7 @@ describe BrDanfe::Dest do
52
52
 
53
53
  pdf.render_file output_pdf
54
54
 
55
- expect("#{base_dir}dest#render-v2.00.pdf").to be_same_file_as(output_pdf)
55
+ expect("#{base_dir}dest#render-v2.00.pdf").to have_same_content_of file: output_pdf
56
56
  end
57
57
  end
58
58
 
@@ -92,7 +92,7 @@ describe BrDanfe::Dest do
92
92
 
93
93
  pdf.render_file output_pdf
94
94
 
95
- expect("#{base_dir}dest#render-v3.10.pdf").to be_same_file_as(output_pdf)
95
+ expect("#{base_dir}dest#render-v3.10.pdf").to have_same_content_of file: output_pdf
96
96
  end
97
97
  end
98
98
 
@@ -114,7 +114,7 @@ describe BrDanfe::Dest do
114
114
 
115
115
  pdf.render_file output_pdf
116
116
 
117
- expect("#{base_dir}dest#render-with_cnpj.pdf").to be_same_file_as(output_pdf)
117
+ expect("#{base_dir}dest#render-with_cnpj.pdf").to have_same_content_of file: output_pdf
118
118
  end
119
119
  end
120
120
 
@@ -136,7 +136,7 @@ describe BrDanfe::Dest do
136
136
 
137
137
  pdf.render_file output_pdf
138
138
 
139
- expect("#{base_dir}dest#render-with_cpf.pdf").to be_same_file_as(output_pdf)
139
+ expect("#{base_dir}dest#render-with_cpf.pdf").to have_same_content_of file: output_pdf
140
140
  end
141
141
  end
142
142
 
@@ -161,7 +161,7 @@ describe BrDanfe::Dest do
161
161
 
162
162
  pdf.render_file output_pdf
163
163
 
164
- expect("#{base_dir}dest#render-with_ie.pdf").to be_same_file_as(output_pdf)
164
+ expect("#{base_dir}dest#render-with_ie.pdf").to have_same_content_of file: output_pdf
165
165
  end
166
166
  end
167
167
  end
@@ -117,7 +117,7 @@ describe BrDanfe::DetBody do
117
117
 
118
118
  pdf.render_file output_pdf
119
119
 
120
- expect("#{base_dir}det_body#render-csosn.pdf").to be_same_file_as(output_pdf)
120
+ expect("#{base_dir}det_body#render-csosn.pdf").to have_same_content_of file: output_pdf
121
121
  end
122
122
  end
123
123
 
@@ -208,7 +208,7 @@ describe BrDanfe::DetBody do
208
208
 
209
209
  pdf.render_file output_pdf
210
210
 
211
- expect("#{base_dir}det_body#render-cst.pdf").to be_same_file_as(output_pdf)
211
+ expect("#{base_dir}det_body#render-cst.pdf").to have_same_content_of file: output_pdf
212
212
  end
213
213
  end
214
214
 
@@ -249,7 +249,7 @@ describe BrDanfe::DetBody do
249
249
 
250
250
  pdf.render_file output_pdf
251
251
 
252
- expect("#{base_dir}det_body#render-fci.pdf").to be_same_file_as(output_pdf)
252
+ expect("#{base_dir}det_body#render-fci.pdf").to have_same_content_of file: output_pdf
253
253
  end
254
254
  end
255
255
 
@@ -292,7 +292,7 @@ describe BrDanfe::DetBody do
292
292
 
293
293
  pdf.render_file output_pdf
294
294
 
295
- expect("#{base_dir}det_body#render-icms_st.pdf").to be_same_file_as(output_pdf)
295
+ expect("#{base_dir}det_body#render-icms_st.pdf").to have_same_content_of file: output_pdf
296
296
  end
297
297
  end
298
298
  end
@@ -20,7 +20,7 @@ describe BrDanfe::DetHeader do
20
20
 
21
21
  pdf.render_file output_pdf
22
22
 
23
- expect("#{base_dir}det_header#render.pdf").to be_same_file_as(output_pdf)
23
+ expect("#{base_dir}det_header#render.pdf").to have_same_content_of file: output_pdf
24
24
  end
25
25
  end
26
26
  end
@@ -34,7 +34,7 @@ describe BrDanfe::Document do
34
34
  subject.lie 0.80, 3.94, 1, 1, xml, "transporta/UF", "transporta/IE"
35
35
  subject.render_file output_pdf
36
36
 
37
- expect("#{base_dir}document#lie-valid.pdf").to be_same_file_as(output_pdf)
37
+ expect("#{base_dir}document#lie-valid.pdf").to have_same_content_of file: output_pdf
38
38
  end
39
39
  end
40
40
 
@@ -60,7 +60,7 @@ describe BrDanfe::Document do
60
60
  subject.lie 0.80, 3.94, 1, 1, xml, "transporta/UF", "transporta/IE"
61
61
  subject.render_file output_pdf
62
62
 
63
- expect("#{base_dir}document#lie-invalid.pdf").to be_same_file_as(output_pdf)
63
+ expect("#{base_dir}document#lie-invalid.pdf").to have_same_content_of file: output_pdf
64
64
  end
65
65
  end
66
66
 
@@ -84,7 +84,7 @@ describe BrDanfe::Document do
84
84
  subject.lie 0.80, 3.94, 1, 1, xml, "transporta/UF", "transporta/IE"
85
85
  subject.render_file output_pdf
86
86
 
87
- expect("#{base_dir}document#lie-blank.pdf").to be_same_file_as(output_pdf)
87
+ expect("#{base_dir}document#lie-blank.pdf").to have_same_content_of file: output_pdf
88
88
  end
89
89
  end
90
90
  end
@@ -116,7 +116,7 @@ describe BrDanfe::Document do
116
116
  subject.lcnpj 0.80, 3.94, 1, 1, xml, "transporta/CNPJ"
117
117
  subject.render_file output_pdf
118
118
 
119
- expect("#{base_dir}document#lcnpj-valid.pdf").to be_same_file_as(output_pdf)
119
+ expect("#{base_dir}document#lcnpj-valid.pdf").to have_same_content_of file: output_pdf
120
120
  end
121
121
  end
122
122
 
@@ -141,7 +141,7 @@ describe BrDanfe::Document do
141
141
  subject.lcnpj 0.80, 3.94, 1, 1, xml, "transporta/CNPJ"
142
142
  subject.render_file output_pdf
143
143
 
144
- expect("#{base_dir}document#lcnpj-invalid.pdf").to be_same_file_as(output_pdf)
144
+ expect("#{base_dir}document#lcnpj-invalid.pdf").to have_same_content_of file: output_pdf
145
145
  end
146
146
  end
147
147
 
@@ -165,7 +165,7 @@ describe BrDanfe::Document do
165
165
  subject.lcnpj 0.80, 3.94, 1, 1, xml, "transporta/CNPJ"
166
166
  subject.render_file output_pdf
167
167
 
168
- expect("#{base_dir}document#lcnpj-blank.pdf").to be_same_file_as(output_pdf)
168
+ expect("#{base_dir}document#lcnpj-blank.pdf").to have_same_content_of file: output_pdf
169
169
  end
170
170
  end
171
171
  end
data/spec/lib/dup_spec.rb CHANGED
@@ -46,7 +46,7 @@ describe BrDanfe::Dup do
46
46
 
47
47
  pdf.render_file output_pdf
48
48
 
49
- expect("#{base_dir}dup#render.pdf").to be_same_file_as(output_pdf)
49
+ expect("#{base_dir}dup#render.pdf").to have_same_content_of file: output_pdf
50
50
  end
51
51
  end
52
52
  end
@@ -55,7 +55,7 @@ describe BrDanfe::EmitHeader do
55
55
 
56
56
  pdf.render_file output_pdf
57
57
 
58
- expect("#{base_dir}emit_header#render-without_logo.pdf").to be_same_file_as(output_pdf)
58
+ expect("#{base_dir}emit_header#render-without_logo.pdf").to have_same_content_of file: output_pdf
59
59
  end
60
60
  end
61
61
 
@@ -69,7 +69,7 @@ describe BrDanfe::EmitHeader do
69
69
 
70
70
  pdf.render_file output_pdf
71
71
 
72
- expect("#{base_dir}emit_header#render-with_logo.pdf").to be_same_file_as(output_pdf)
72
+ expect("#{base_dir}emit_header#render-with_logo.pdf").to have_same_content_of file: output_pdf
73
73
  end
74
74
  end
75
75
  end
@@ -48,7 +48,7 @@ describe BrDanfe::Emit do
48
48
 
49
49
  pdf.render_file output_pdf
50
50
 
51
- expect("#{base_dir}emit#render.pdf").to be_same_file_as(output_pdf)
51
+ expect("#{base_dir}emit#render.pdf").to have_same_content_of file: output_pdf
52
52
  end
53
53
  end
54
54
  end