br_danfe 1.2.3 → 2.1.0

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.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/config.yml +5 -7
  3. data/Gemfile +15 -0
  4. data/Gemfile.lock +45 -27
  5. data/br_danfe.gemspec +1 -12
  6. data/config/locales/pt-BR.yml +4 -3
  7. data/lib/br_danfe/cce_lib/document.rb +2 -2
  8. data/lib/br_danfe/danfe_lib/nfce_lib/document.rb +2 -2
  9. data/lib/br_danfe/danfe_lib/nfce_lib/header.rb +1 -1
  10. data/lib/br_danfe/danfe_lib/nfe_lib/dest.rb +2 -10
  11. data/lib/br_danfe/danfe_lib/nfe_lib/document.rb +9 -9
  12. data/lib/br_danfe/danfe_lib/nfe_lib/emit_header.rb +9 -1
  13. data/lib/br_danfe/danfe_lib/nfe_lib/entrega.rb +2 -10
  14. data/lib/br_danfe/danfe_lib/nfe_lib/infadic.rb +1 -1
  15. data/lib/br_danfe/danfe_lib/nfe_lib/transp.rb +1 -1
  16. data/lib/br_danfe/document_builder.rb +2 -2
  17. data/lib/br_danfe/logo_options.rb +1 -1
  18. data/lib/br_danfe/mdfe_lib/document.rb +2 -2
  19. data/lib/br_danfe/version.rb +1 -1
  20. data/lib/br_danfe.rb +1 -1
  21. data/lib/prawn/font.rb +1 -1
  22. data/spec/br_danfe/cce_lib/barcode_spec.rb +1 -1
  23. data/spec/br_danfe/cce_lib/correction_spec.rb +1 -1
  24. data/spec/br_danfe/cce_lib/document_spec.rb +7 -7
  25. data/spec/br_danfe/cce_lib/footer_spec.rb +1 -1
  26. data/spec/br_danfe/cce_lib/header_spec.rb +1 -1
  27. data/spec/br_danfe/cce_lib/nfe_key_spec.rb +1 -1
  28. data/spec/br_danfe/cce_lib/protocol_spec.rb +1 -1
  29. data/spec/br_danfe/cce_spec.rb +2 -2
  30. data/spec/br_danfe/danfe_lib/nfce_lib/document_spec.rb +1 -1
  31. data/spec/br_danfe/danfe_lib/nfce_lib/footer_spec.rb +1 -1
  32. data/spec/br_danfe/danfe_lib/nfce_lib/header_spec.rb +2 -2
  33. data/spec/br_danfe/danfe_lib/nfce_lib/key_spec.rb +1 -1
  34. data/spec/br_danfe/danfe_lib/nfce_lib/nfce_identification_spec.rb +1 -1
  35. data/spec/br_danfe/danfe_lib/nfce_lib/product_list_spec.rb +1 -1
  36. data/spec/br_danfe/danfe_lib/nfce_lib/recipient_spec.rb +1 -1
  37. data/spec/br_danfe/danfe_lib/nfce_lib/total_list_spec.rb +1 -1
  38. data/spec/br_danfe/danfe_lib/nfce_spec.rb +3 -3
  39. data/spec/br_danfe/danfe_lib/nfe_lib/dest_spec.rb +1 -1
  40. data/spec/br_danfe/danfe_lib/nfe_lib/det_body_spec.rb +8 -8
  41. data/spec/br_danfe/danfe_lib/nfe_lib/document_spec.rb +9 -9
  42. data/spec/br_danfe/danfe_lib/nfe_lib/dup_spec.rb +1 -1
  43. data/spec/br_danfe/danfe_lib/nfe_lib/emit_header_spec.rb +66 -3
  44. data/spec/br_danfe/danfe_lib/nfe_lib/entrega_spec.rb +1 -1
  45. data/spec/br_danfe/danfe_lib/nfe_lib/icmstot_spec.rb +1 -1
  46. data/spec/br_danfe/danfe_lib/nfe_lib/infadic_spec.rb +1 -1
  47. data/spec/br_danfe/danfe_lib/nfe_lib/infadic_vol_spec.rb +1 -1
  48. data/spec/br_danfe/danfe_lib/nfe_lib/issqn_spec.rb +1 -1
  49. data/spec/br_danfe/danfe_lib/nfe_lib/ticket_spec.rb +3 -3
  50. data/spec/br_danfe/danfe_lib/nfe_lib/transp_spec.rb +1 -1
  51. data/spec/br_danfe/danfe_lib/nfe_lib/vol_spec.rb +1 -1
  52. data/spec/br_danfe/danfe_lib/nfe_spec.rb +6 -6
  53. data/spec/br_danfe/mdfe_lib/fisco_control_spec.rb +1 -1
  54. data/spec/br_danfe/mdfe_lib/header_spec.rb +1 -1
  55. data/spec/br_danfe/mdfe_lib/notes_spec.rb +1 -1
  56. data/spec/br_danfe/mdfe_spec.rb +2 -2
  57. data/spec/br_danfe/qr_code_spec.rb +1 -1
  58. data/spec/fixtures/nfe/lib/emit_header#render-nfe_key.pdf +16 -16
  59. data/spec/fixtures/nfe/lib/emit_header#render-second_page.pdf +16 -16
  60. data/spec/fixtures/nfe/lib/emit_header#render-with_cpf.pdf +1075 -2
  61. data/spec/fixtures/nfe/lib/emit_header#render-with_logo.pdf +16 -16
  62. data/spec/fixtures/nfe/lib/emit_header#render-without_logo.pdf +14 -14
  63. data/spec/fixtures/nfe/lib/entrega#render-v2.00.pdf +0 -0
  64. data/spec/fixtures/nfe/lib/entrega#render-with-address-bigger.pdf +0 -0
  65. data/spec/fixtures/nfe/lib/entrega#render-with_cpf.pdf +0 -0
  66. data/spec/fixtures/nfe/v2.00/custom_options.fixture.pdf +17 -17
  67. data/spec/fixtures/nfe/v2.00/nfe_simples_nacional.xml.fixture.pdf +15 -15
  68. data/spec/fixtures/nfe/v2.00/nfe_with_entrega.xml.fixture.pdf +16 -16
  69. data/spec/fixtures/nfe/v2.00/nfe_with_extra_volumes.xml.fixture.pdf +24 -24
  70. data/spec/fixtures/nfe/v2.00/nfe_with_fci.xml.fixture.pdf +15 -15
  71. data/spec/fixtures/nfe/v2.00/nfe_with_ns.xml.fixture.pdf +19 -19
  72. data/spec/fixtures/nfe/v2.00/nfe_without_ns.xml.fixture.pdf +15 -15
  73. data/spec/fixtures/nfe/v3.10/multiples.xmls.on.the.same.pdf.pdf +19 -19
  74. data/spec/fixtures/nfe/v3.10/nfe_simples_nacional.xml.fixture.pdf +15 -15
  75. data/spec/fixtures/nfe/v3.10/with_footer.fixture.pdf +19 -19
  76. data/spec/fixtures/nfe/v3.10/with_issqn.fixture.pdf +15 -15
  77. data/spec/fixtures/nfe/v3.10/with_three_pages.fixture.pdf +23 -23
  78. data/spec/fixtures/nfe/v3.10/without_issqn.fixture.pdf +19 -19
  79. data/spec/spec_helper.rb +9 -1
  80. metadata +8 -160
  81. /data/spec/fixtures/nfe/lib/{document#lcnpj-blank.pdf → document#lcnpj_cpf-blank.pdf} +0 -0
  82. /data/spec/fixtures/nfe/lib/{document#lcnpj-invalid.pdf → document#lcnpj_cpf-invalid.pdf} +0 -0
  83. /data/spec/fixtures/nfe/lib/{document#lcnpj-valid.pdf → document#lcnpj_cpf-valid.pdf} +0 -0
@@ -31,7 +31,7 @@ describe BrDanfe::DanfeLib::NfceLib::Key do
31
31
  describe '#render' do
32
32
  before do
33
33
  subject.render
34
- File.delete(output_pdf) if File.exist?(output_pdf)
34
+ FileUtils.rm_f(output_pdf)
35
35
  end
36
36
 
37
37
  it 'renders key to the pdf' do
@@ -35,7 +35,7 @@ describe BrDanfe::DanfeLib::NfceLib::NfceIdentification do
35
35
  describe '#render' do
36
36
  before do
37
37
  subject.render
38
- File.delete(output_pdf) if File.exist?(output_pdf)
38
+ FileUtils.rm_f(output_pdf)
39
39
  end
40
40
 
41
41
  it 'renders nfce identification to the pdf' do
@@ -12,7 +12,7 @@ describe BrDanfe::DanfeLib::NfceLib::ProductList do
12
12
  describe '#render' do
13
13
  before do
14
14
  subject.render
15
- File.delete(output_pdf) if File.exist?(output_pdf)
15
+ FileUtils.rm_f(output_pdf)
16
16
  end
17
17
 
18
18
  context 'when does not have a long name' do
@@ -12,7 +12,7 @@ describe BrDanfe::DanfeLib::NfceLib::Recipient do
12
12
  describe '#render' do
13
13
  before do
14
14
  subject.render
15
- File.delete(output_pdf) if File.exist?(output_pdf)
15
+ FileUtils.rm_f(output_pdf)
16
16
  end
17
17
 
18
18
  context 'when has identified recipient' do
@@ -52,7 +52,7 @@ describe BrDanfe::DanfeLib::NfceLib::TotalList do
52
52
  describe '#render' do
53
53
  before do
54
54
  subject.render
55
- File.delete(output_pdf) if File.exist?(output_pdf)
55
+ FileUtils.rm_f(output_pdf)
56
56
  end
57
57
 
58
58
  it 'renders the total list' do
@@ -14,15 +14,15 @@ describe BrDanfe::DanfeLib::Nfce do
14
14
 
15
15
  describe '#render_pdf' do
16
16
  it 'renders the NFC-e pdf' do
17
- expected = IO.binread("#{base_dir}rendered_nfce.fixture.pdf")
17
+ expected = File.binread("#{base_dir}rendered_nfce.fixture.pdf")
18
18
 
19
19
  expect(subject.render_pdf).to eq expected
20
20
  end
21
21
  end
22
22
 
23
23
  describe '#save_pdf' do
24
- before { File.delete(output_pdf) if File.exist?(output_pdf) }
25
- after { File.delete(output_pdf) if File.exist?(output_pdf) }
24
+ before { FileUtils.rm_f(output_pdf) }
25
+ after { FileUtils.rm_f(output_pdf) }
26
26
 
27
27
  it 'saves the NFC-e as pdf' do
28
28
  expect(File.exist?(output_pdf)).to be_falsey
@@ -10,7 +10,7 @@ describe BrDanfe::DanfeLib::NfeLib::Dest do
10
10
 
11
11
  describe '#render' do
12
12
  before do
13
- File.delete(path_of_expected_pdf) if File.exist?(path_of_expected_pdf)
13
+ FileUtils.rm_f(path_of_expected_pdf)
14
14
  subject.render
15
15
  end
16
16
 
@@ -17,7 +17,7 @@ describe BrDanfe::DanfeLib::NfeLib::DetBody do
17
17
  XML
18
18
  end
19
19
 
20
- let(:product_1) do
20
+ let(:product1) do
21
21
  <<~XML
22
22
  <det nItem="1">
23
23
  <prod>
@@ -34,7 +34,7 @@ describe BrDanfe::DanfeLib::NfeLib::DetBody do
34
34
  XML
35
35
  end
36
36
 
37
- let(:product_2) do
37
+ let(:product2) do
38
38
  <<~XML
39
39
  <det nItem="2">
40
40
  <prod>
@@ -59,7 +59,7 @@ describe BrDanfe::DanfeLib::NfeLib::DetBody do
59
59
  describe '#render' do
60
60
  before do
61
61
  subject.render has_issqn
62
- File.delete(output_pdf) if File.exist?(output_pdf)
62
+ FileUtils.rm_f(output_pdf)
63
63
  end
64
64
 
65
65
  context 'with CSOSN' do
@@ -383,7 +383,7 @@ describe BrDanfe::DanfeLib::NfeLib::DetBody do
383
383
 
384
384
  context 'when there is ISSQN' do
385
385
  let(:has_issqn) { true }
386
- let(:products) { "#{product_1}\n#{product_2}" * 10 }
386
+ let(:products) { "#{product1}\n#{product2}" * 10 }
387
387
 
388
388
  it 'renders xml to the pdf' do
389
389
  expect(File.exist?(output_pdf)).to be_falsey
@@ -395,7 +395,7 @@ describe BrDanfe::DanfeLib::NfeLib::DetBody do
395
395
  end
396
396
 
397
397
  context "when there isn't ISSQN" do
398
- let(:products) { "#{product_1}\n#{product_2}" * 10 }
398
+ let(:products) { "#{product1}\n#{product2}" * 10 }
399
399
 
400
400
  it 'renders xml to the pdf' do
401
401
  expect(File.exist?(output_pdf)).to be_falsey
@@ -407,7 +407,7 @@ describe BrDanfe::DanfeLib::NfeLib::DetBody do
407
407
  end
408
408
 
409
409
  context 'with infAdProd' do
410
- let(:products) { product_2.to_s }
410
+ let(:products) { product2.to_s }
411
411
 
412
412
  it 'renders xml to the pdf' do
413
413
  expect(File.exist?(output_pdf)).to be_falsey
@@ -493,7 +493,7 @@ describe BrDanfe::DanfeLib::NfeLib::DetBody do
493
493
 
494
494
  context 'when the product table occupies more than one page' do
495
495
  context 'when the product table occupies two pages' do
496
- let(:products) { ("#{product_1}\n#{product_2}" * 22) + "\n#{product_1}" }
496
+ let(:products) { ("#{product1}\n#{product2}" * 22) + "\n#{product1}" }
497
497
 
498
498
  it 'renders xml to the pdf' do
499
499
  expect(File.exist?(output_pdf)).to be_falsey
@@ -505,7 +505,7 @@ describe BrDanfe::DanfeLib::NfeLib::DetBody do
505
505
  end
506
506
 
507
507
  context 'when the product table occupies three pages' do
508
- let(:products) { ("#{product_1}\n#{product_2}" * 23) }
508
+ let(:products) { ("#{product1}\n#{product2}" * 23) }
509
509
 
510
510
  it 'renders xml to the pdf' do
511
511
  expect(File.exist?(output_pdf)).to be_falsey
@@ -9,7 +9,7 @@ describe BrDanfe::DanfeLib::NfeLib::Document do
9
9
  describe '#lie' do
10
10
  before do
11
11
  subject.render
12
- File.delete(output_pdf) if File.exist?(output_pdf)
12
+ FileUtils.rm_f(output_pdf)
13
13
  end
14
14
 
15
15
  context 'when IE is valid' do
@@ -114,10 +114,10 @@ describe BrDanfe::DanfeLib::NfeLib::Document do
114
114
  end
115
115
  end
116
116
 
117
- describe '#lcnpj' do
117
+ describe '#lcnpj_cpf' do
118
118
  before do
119
119
  subject.render
120
- File.delete(output_pdf) if File.exist?(output_pdf)
120
+ FileUtils.rm_f(output_pdf)
121
121
  end
122
122
 
123
123
  context 'when CNPJ is valid' do
@@ -138,10 +138,10 @@ describe BrDanfe::DanfeLib::NfeLib::Document do
138
138
  it 'renders a box with a formated CNPJ to the pdf' do
139
139
  expect(File.exist?(output_pdf)).to be_falsey
140
140
 
141
- subject.lcnpj 0.80, 3.94, 0.75, 1.85, xml, 'transporta/CNPJ'
141
+ subject.lcnpj_cpf 0.80, 3.94, 0.75, 1.85, xml, 'transporta/CNPJ'
142
142
  subject.render_file output_pdf
143
143
 
144
- expect("#{base_dir}document#lcnpj-valid.pdf").to have_same_content_of file: output_pdf
144
+ expect("#{base_dir}document#lcnpj_cpf-valid.pdf").to have_same_content_of file: output_pdf
145
145
  end
146
146
  end
147
147
 
@@ -163,10 +163,10 @@ describe BrDanfe::DanfeLib::NfeLib::Document do
163
163
  it 'renders a blank box to the pdf' do
164
164
  expect(File.exist?(output_pdf)).to be_falsey
165
165
 
166
- subject.lcnpj 0.80, 3.94, 0.75, 1.85, xml, 'transporta/CNPJ'
166
+ subject.lcnpj_cpf 0.80, 3.94, 0.75, 1.85, xml, 'transporta/CNPJ'
167
167
  subject.render_file output_pdf
168
168
 
169
- expect("#{base_dir}document#lcnpj-invalid.pdf").to have_same_content_of file: output_pdf
169
+ expect("#{base_dir}document#lcnpj_cpf-invalid.pdf").to have_same_content_of file: output_pdf
170
170
  end
171
171
  end
172
172
 
@@ -187,10 +187,10 @@ describe BrDanfe::DanfeLib::NfeLib::Document do
187
187
  it 'renders a blank box to the pdf' do
188
188
  expect(File.exist?(output_pdf)).to be_falsey
189
189
 
190
- subject.lcnpj 0.80, 3.94, 0.75, 1.85, xml, 'transporta/CNPJ'
190
+ subject.lcnpj_cpf 0.80, 3.94, 0.75, 1.85, xml, 'transporta/CNPJ'
191
191
  subject.render_file output_pdf
192
192
 
193
- expect("#{base_dir}document#lcnpj-blank.pdf").to have_same_content_of file: output_pdf
193
+ expect("#{base_dir}document#lcnpj_cpf-blank.pdf").to have_same_content_of file: output_pdf
194
194
  end
195
195
  end
196
196
  end
@@ -38,7 +38,7 @@ describe BrDanfe::DanfeLib::NfeLib::Dup do
38
38
 
39
39
  before do
40
40
  subject.render
41
- File.delete(output_pdf) if File.exist?(output_pdf)
41
+ FileUtils.rm_f(output_pdf)
42
42
  end
43
43
 
44
44
  it 'renders xml to the pdf' do
@@ -62,7 +62,7 @@ describe BrDanfe::DanfeLib::NfeLib::EmitHeader do
62
62
 
63
63
  it 'renders only the nfe key' do
64
64
  subject.render 2, 1.85, 2
65
- File.delete(output_pdf) if File.exist?(output_pdf)
65
+ FileUtils.rm_f(output_pdf)
66
66
 
67
67
  pdf.render_file output_pdf
68
68
 
@@ -72,7 +72,7 @@ describe BrDanfe::DanfeLib::NfeLib::EmitHeader do
72
72
  context 'render emitter on first page' do
73
73
  before do
74
74
  subject.render 1, 3.96, 1
75
- File.delete(output_pdf) if File.exist?(output_pdf)
75
+ FileUtils.rm_f(output_pdf)
76
76
  end
77
77
 
78
78
  context 'with logo' do
@@ -101,7 +101,7 @@ describe BrDanfe::DanfeLib::NfeLib::EmitHeader do
101
101
  context 'render emitter on second page' do
102
102
  before do
103
103
  subject.render 2, 1.85, 2
104
- File.delete(output_pdf) if File.exist?(output_pdf)
104
+ FileUtils.rm_f(output_pdf)
105
105
  end
106
106
 
107
107
  context 'with logo' do
@@ -114,5 +114,68 @@ describe BrDanfe::DanfeLib::NfeLib::EmitHeader do
114
114
  end
115
115
  end
116
116
  end
117
+
118
+ context 'when emitter has CPF instead of CNPJ' do
119
+ let(:xml_as_string) do
120
+ <<~XML
121
+ <nfeProc xmlns="http://www.portalfiscal.inf.br/nfe" versao="2.00">
122
+ <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
123
+ <infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
124
+ <ide>
125
+ <tpNF>1</tpNF>
126
+ <nNF>1</nNF>
127
+ <serie>1</serie>
128
+ <natOp>Vendas de producao do estabelecimento</natOp>
129
+ </ide>
130
+ <emit>
131
+ <xNome>Nome do Remetente</xNome>
132
+ <CPF>86893723008</CPF>
133
+ <IE>526926313553</IE>
134
+ <enderEmit>
135
+ <xLgr>Rua do Remetente, Casa</xLgr>
136
+ <nro>123</nro>
137
+ <xBairro>Bairro do Remetente</xBairro>
138
+ <xMun>SAO PAULO</xMun>
139
+ <UF>SP</UF>
140
+ <CEP>12345678</CEP>
141
+ <fone>1112345678</fone>
142
+ <email>foo@bar.com</email>
143
+ </enderEmit>
144
+ </emit>
145
+ <det nItem="1">
146
+ <prod>
147
+ <detExport>
148
+ <exportInd>
149
+ <chNFe>41211285493849000105550020000027171182910239</chNFe>
150
+ </exportInd>
151
+ </detExport>
152
+ </prod>
153
+ </det>
154
+ </infNFe>
155
+ </NFe>
156
+ <protNFe xmlns="http://www.portalfiscal.inf.br/nfe" versao="2.00">
157
+ <infProt Id="ID325110012866320">
158
+ <chNFe>25111012345678901234550020000134151000134151</chNFe>
159
+ <dhRecbto>2011-10-29T14:37:09</dhRecbto>
160
+ <nProt>325110012866320</nProt>
161
+ </infProt>
162
+ </protNFe>
163
+ </nfeProc>
164
+ XML
165
+ end
166
+
167
+ before do
168
+ subject.render 1, 3.96, 1
169
+ FileUtils.rm_f(output_pdf)
170
+ end
171
+
172
+ it 'renders xml with CPF to the pdf' do
173
+ expect(File.exist?(output_pdf)).to be_falsey
174
+
175
+ pdf.render_file output_pdf
176
+
177
+ expect("#{base_dir}emit_header#render-with_cpf.pdf").to have_same_content_of file: output_pdf
178
+ end
179
+ end
117
180
  end
118
181
  end
@@ -11,7 +11,7 @@ describe BrDanfe::DanfeLib::NfeLib::Entrega do
11
11
  describe '#render' do
12
12
  before do
13
13
  subject.render
14
- File.delete(path_of_expected_pdf) if File.exist?(path_of_expected_pdf)
14
+ FileUtils.rm_f(path_of_expected_pdf)
15
15
  end
16
16
 
17
17
  context "when nf-e's version is 2.00" do
@@ -34,7 +34,7 @@ describe BrDanfe::DanfeLib::NfeLib::Icmstot do
34
34
 
35
35
  before do
36
36
  subject.render
37
- File.delete(output_pdf) if File.exist?(output_pdf)
37
+ FileUtils.rm_f(output_pdf)
38
38
  end
39
39
 
40
40
  it 'renders xml to the pdf' do
@@ -14,7 +14,7 @@ describe BrDanfe::DanfeLib::NfeLib::Infadic do
14
14
 
15
15
  before do
16
16
  subject.render(volumes_number)
17
- File.delete(output_pdf) if File.exist?(output_pdf)
17
+ FileUtils.rm_f(output_pdf)
18
18
  end
19
19
 
20
20
  context 'when there is no information' do
@@ -80,7 +80,7 @@ describe BrDanfe::DanfeLib::NfeLib::InfadicVol do
80
80
 
81
81
  before do
82
82
  subject.render
83
- File.delete(output_pdf) if File.exist?(output_pdf)
83
+ FileUtils.rm_f(output_pdf)
84
84
  end
85
85
 
86
86
  it 'renders extra volumes to the pdf' do
@@ -37,7 +37,7 @@ describe BrDanfe::DanfeLib::NfeLib::Issqn do
37
37
 
38
38
  before do
39
39
  subject.render
40
- File.delete(output_pdf) if File.exist?(output_pdf)
40
+ FileUtils.rm_f(output_pdf)
41
41
  end
42
42
 
43
43
  context 'with ISSQN' do
@@ -38,7 +38,7 @@ describe BrDanfe::DanfeLib::NfeLib::Ticket do
38
38
 
39
39
  before do
40
40
  subject.render
41
- File.delete(output_pdf) if File.exist?(output_pdf)
41
+ FileUtils.rm_f(output_pdf)
42
42
  end
43
43
 
44
44
  it 'renders xml to the pdf' do
@@ -81,7 +81,7 @@ describe BrDanfe::DanfeLib::NfeLib::Ticket do
81
81
 
82
82
  before do
83
83
  subject.render
84
- File.delete(output_pdf) if File.exist?(output_pdf)
84
+ FileUtils.rm_f(output_pdf)
85
85
  end
86
86
 
87
87
  it 'renders xml to the pdf' do
@@ -124,7 +124,7 @@ describe BrDanfe::DanfeLib::NfeLib::Ticket do
124
124
 
125
125
  before do
126
126
  subject.render
127
- File.delete(output_pdf) if File.exist?(output_pdf)
127
+ FileUtils.rm_f(output_pdf)
128
128
  end
129
129
 
130
130
  it 'renders xml to the pdf' do
@@ -37,7 +37,7 @@ describe BrDanfe::DanfeLib::NfeLib::Transp do
37
37
 
38
38
  before do
39
39
  subject.render
40
- File.delete(output_pdf) if File.exist?(output_pdf)
40
+ FileUtils.rm_f(output_pdf)
41
41
  end
42
42
 
43
43
  it 'renders xml to the pdf' do
@@ -47,7 +47,7 @@ describe BrDanfe::DanfeLib::NfeLib::Vol do
47
47
 
48
48
  before do
49
49
  subject.render
50
- File.delete(output_pdf) if File.exist?(output_pdf)
50
+ FileUtils.rm_f(output_pdf)
51
51
  end
52
52
 
53
53
  it 'renders xml to the pdf' do
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe BrDanfe::DanfeLib::Nfe do
4
4
  let(:output_pdf) { "#{base_dir}output.pdf" }
5
- let(:xml_file) {}
5
+ let(:xml_file) {} # rubocop:disable Lint/EmptyBlock
6
6
  let(:xml) { BrDanfe::XML.new(xml_file) }
7
7
 
8
8
  subject { described_class.new [xml] }
@@ -12,7 +12,7 @@ describe BrDanfe::DanfeLib::Nfe do
12
12
  let(:xml_file) { File.read("#{base_dir}nfe_simples_nacional.xml") }
13
13
 
14
14
  it 'renders a Simples Nacional NF-e using CSOSN' do
15
- expected = IO.binread("#{base_dir}nfe_simples_nacional.xml.fixture.pdf")
15
+ expected = File.binread("#{base_dir}nfe_simples_nacional.xml.fixture.pdf")
16
16
  expect(subject.render_pdf).to eq expected
17
17
  end
18
18
  end
@@ -22,7 +22,7 @@ describe BrDanfe::DanfeLib::Nfe do
22
22
  let(:base_dir) { './spec/fixtures/nfe/v2.00/' }
23
23
  let(:xml_file) { File.read("#{base_dir}custom_options.fixture.xml") }
24
24
 
25
- before { File.delete(output_pdf) if File.exist?(output_pdf) }
25
+ before { FileUtils.rm_f(output_pdf) }
26
26
 
27
27
  it 'render a NF-e with customized options' do
28
28
  expect(File.exist?(output_pdf)).to be_falsey
@@ -39,7 +39,7 @@ describe BrDanfe::DanfeLib::Nfe do
39
39
  let(:base_dir) { './spec/fixtures/nfe/v2.00/' }
40
40
  let(:xml_file) { File.read("#{base_dir}nfe_with_ns.xml") }
41
41
 
42
- before { File.delete(output_pdf) if File.exist?(output_pdf) }
42
+ before { FileUtils.rm_f(output_pdf) }
43
43
 
44
44
  it 'renders a basic NF-e with namespace' do
45
45
  expect(File.exist?(output_pdf)).to be_falsey
@@ -108,7 +108,7 @@ describe BrDanfe::DanfeLib::Nfe do
108
108
  let(:base_dir) { './spec/fixtures/nfe/v3.10/' }
109
109
  let(:xml_file) { File.read("#{base_dir}nfe_simples_nacional.xml") }
110
110
 
111
- before { File.delete(output_pdf) if File.exist?(output_pdf) }
111
+ before { FileUtils.rm_f(output_pdf) }
112
112
 
113
113
  it 'renders a Simples Nacional NF-e using CSOSN' do
114
114
  expect(File.exist?(output_pdf)).to be_falsey
@@ -168,7 +168,7 @@ describe BrDanfe::DanfeLib::Nfe do
168
168
  let(:base_dir) { './spec/fixtures/nfe/v3.10/' }
169
169
  let(:xml_file) { File.read("#{base_dir}nfe_simples_nacional.xml") }
170
170
 
171
- before { File.delete(output_pdf) if File.exist?(output_pdf) }
171
+ before { FileUtils.rm_f(output_pdf) }
172
172
 
173
173
  it 'renders multiple danfes on the same pdf' do
174
174
  expect(File.exist?(output_pdf)).to be_falsey
@@ -27,7 +27,7 @@ describe BrDanfe::MdfeLib::FiscoControl do
27
27
  end
28
28
 
29
29
  describe '#generate' do
30
- before { File.delete(output_pdf) if File.exist?(output_pdf) }
30
+ before { FileUtils.rm_f(output_pdf) }
31
31
 
32
32
  it 'generates the title' do
33
33
  subject.generate
@@ -57,7 +57,7 @@ describe BrDanfe::MdfeLib::Header do
57
57
  let(:base_dir) { './spec/fixtures/mdfe/lib/' }
58
58
  let(:output_pdf) { "#{base_dir}output.pdf" }
59
59
 
60
- before { File.delete(output_pdf) if File.exist?(output_pdf) }
60
+ before { FileUtils.rm_f(output_pdf) }
61
61
 
62
62
  it 'generates the emitter informations' do
63
63
  emitter_name = 'VENTURIM AGROCRIATIVA LTDA EPP'
@@ -37,7 +37,7 @@ describe BrDanfe::MdfeLib::Notes do
37
37
  let(:base_dir) { './spec/fixtures/mdfe/lib/' }
38
38
  let(:output_pdf) { "#{base_dir}output.pdf" }
39
39
 
40
- before { File.delete(output_pdf) if File.exist?(output_pdf) }
40
+ before { FileUtils.rm_f(output_pdf) }
41
41
 
42
42
  it 'generates the title' do
43
43
  title = 'Observações'
@@ -8,7 +8,7 @@ describe BrDanfe::Mdfe do
8
8
 
9
9
  subject { described_class.new(xml) }
10
10
 
11
- before { File.delete(output_pdf) if File.exist?(output_pdf) }
11
+ before { FileUtils.rm_f(output_pdf) }
12
12
 
13
13
  before do
14
14
  subject.logo_options.logo_dimensions = { width: 100, height: 100 }
@@ -17,7 +17,7 @@ describe BrDanfe::Mdfe do
17
17
 
18
18
  describe '#render_pdf' do
19
19
  it 'renders the mdfe' do
20
- expected = IO.binread("#{base_dir}mdfe.fixture.pdf")
20
+ expected = File.binread("#{base_dir}mdfe.fixture.pdf")
21
21
 
22
22
  expect(subject.render_pdf).to eql expected
23
23
  end
@@ -18,7 +18,7 @@ describe BrDanfe::QrCode do
18
18
  subject { described_class.new(pdf: pdf, qr_code_tag: qr_code_url, box_size: 3.cm) }
19
19
 
20
20
  describe '#render' do
21
- before { File.delete(output_pdf) if File.exist?(output_pdf) }
21
+ before { FileUtils.rm_f(output_pdf) }
22
22
 
23
23
  it 'renders qr-code to the pdf' do
24
24
  expect(File.exist?(output_pdf)).to be_falsey
@@ -17,7 +17,7 @@ endobj
17
17
  >>
18
18
  endobj
19
19
  4 0 obj
20
- << /Length 11058
20
+ << /Length 11066
21
21
  >>
22
22
  stream
23
23
  q
@@ -677,7 +677,7 @@ S
677
677
  BT
678
678
  398.0 685.49554 Td
679
679
  /F1.0 6 Tf
680
- <434e504a> Tj
680
+ <434e504a2f435046> Tj
681
681
  ET
682
682
 
683
683
 
@@ -1056,24 +1056,24 @@ xref
1056
1056
  0000000109 00000 n
1057
1057
  0000000158 00000 n
1058
1058
  0000000215 00000 n
1059
- 0000011326 00000 n
1060
- 0000011659 00000 n
1061
- 0000011824 00000 n
1062
- 0000011992 00000 n
1063
- 0000014379 00000 n
1064
- 0000014753 00000 n
1065
- 0000026482 00000 n
1066
- 0000026693 00000 n
1067
- 0000027315 00000 n
1068
- 0000027657 00000 n
1069
- 0000049438 00000 n
1070
- 0000049651 00000 n
1071
- 0000050314 00000 n
1059
+ 0000011334 00000 n
1060
+ 0000011667 00000 n
1061
+ 0000011832 00000 n
1062
+ 0000012000 00000 n
1063
+ 0000014387 00000 n
1064
+ 0000014761 00000 n
1065
+ 0000026490 00000 n
1066
+ 0000026701 00000 n
1067
+ 0000027323 00000 n
1068
+ 0000027665 00000 n
1069
+ 0000049446 00000 n
1070
+ 0000049659 00000 n
1071
+ 0000050322 00000 n
1072
1072
  trailer
1073
1073
  << /Info 1 0 R
1074
1074
  /Root 2 0 R
1075
1075
  /Size 18
1076
1076
  >>
1077
1077
  startxref
1078
- 50866
1078
+ 50874
1079
1079
  %%EOF
@@ -17,7 +17,7 @@ endobj
17
17
  >>
18
18
  endobj
19
19
  4 0 obj
20
- << /Length 11058
20
+ << /Length 11066
21
21
  >>
22
22
  stream
23
23
  q
@@ -677,7 +677,7 @@ S
677
677
  BT
678
678
  398.0 685.49554 Td
679
679
  /F1.0 6 Tf
680
- <434e504a> Tj
680
+ <434e504a2f435046> Tj
681
681
  ET
682
682
 
683
683
 
@@ -1056,24 +1056,24 @@ xref
1056
1056
  0000000109 00000 n
1057
1057
  0000000158 00000 n
1058
1058
  0000000215 00000 n
1059
- 0000011326 00000 n
1060
- 0000011659 00000 n
1061
- 0000011824 00000 n
1062
- 0000011992 00000 n
1063
- 0000014379 00000 n
1064
- 0000014753 00000 n
1065
- 0000026482 00000 n
1066
- 0000026693 00000 n
1067
- 0000027315 00000 n
1068
- 0000027657 00000 n
1069
- 0000049438 00000 n
1070
- 0000049651 00000 n
1071
- 0000050314 00000 n
1059
+ 0000011334 00000 n
1060
+ 0000011667 00000 n
1061
+ 0000011832 00000 n
1062
+ 0000012000 00000 n
1063
+ 0000014387 00000 n
1064
+ 0000014761 00000 n
1065
+ 0000026490 00000 n
1066
+ 0000026701 00000 n
1067
+ 0000027323 00000 n
1068
+ 0000027665 00000 n
1069
+ 0000049446 00000 n
1070
+ 0000049659 00000 n
1071
+ 0000050322 00000 n
1072
1072
  trailer
1073
1073
  << /Info 1 0 R
1074
1074
  /Root 2 0 R
1075
1075
  /Size 18
1076
1076
  >>
1077
1077
  startxref
1078
- 50866
1078
+ 50874
1079
1079
  %%EOF