br_danfe 1.2.2 → 2.0.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 (186) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/config.yml +2 -2
  3. data/Gemfile +14 -0
  4. data/Gemfile.lock +59 -42
  5. data/README.md +10 -4
  6. data/br_danfe.gemspec +2 -13
  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/document.rb +4 -4
  11. data/lib/br_danfe/danfe_lib/nfe_lib/infadic.rb +1 -1
  12. data/lib/br_danfe/document_builder.rb +2 -2
  13. data/lib/br_danfe/logo_options.rb +1 -1
  14. data/lib/br_danfe/mdfe_lib/document.rb +2 -2
  15. data/lib/br_danfe/version.rb +1 -1
  16. data/lib/br_danfe.rb +1 -1
  17. data/lib/prawn/font.rb +1 -1
  18. data/spec/br_danfe/cce_lib/barcode_spec.rb +1 -1
  19. data/spec/br_danfe/cce_lib/correction_spec.rb +1 -1
  20. data/spec/br_danfe/cce_lib/document_spec.rb +7 -7
  21. data/spec/br_danfe/cce_lib/footer_spec.rb +1 -1
  22. data/spec/br_danfe/cce_lib/header_spec.rb +1 -1
  23. data/spec/br_danfe/cce_lib/nfe_key_spec.rb +1 -1
  24. data/spec/br_danfe/cce_lib/protocol_spec.rb +1 -1
  25. data/spec/br_danfe/cce_spec.rb +2 -2
  26. data/spec/br_danfe/danfe_lib/nfce_lib/document_spec.rb +1 -1
  27. data/spec/br_danfe/danfe_lib/nfce_lib/footer_spec.rb +1 -1
  28. data/spec/br_danfe/danfe_lib/nfce_lib/header_spec.rb +2 -2
  29. data/spec/br_danfe/danfe_lib/nfce_lib/key_spec.rb +1 -1
  30. data/spec/br_danfe/danfe_lib/nfce_lib/nfce_identification_spec.rb +1 -1
  31. data/spec/br_danfe/danfe_lib/nfce_lib/product_list_spec.rb +1 -1
  32. data/spec/br_danfe/danfe_lib/nfce_lib/recipient_spec.rb +1 -1
  33. data/spec/br_danfe/danfe_lib/nfce_lib/total_list_spec.rb +1 -1
  34. data/spec/br_danfe/danfe_lib/nfce_spec.rb +3 -3
  35. data/spec/br_danfe/danfe_lib/nfe_lib/dest_spec.rb +1 -1
  36. data/spec/br_danfe/danfe_lib/nfe_lib/det_body_spec.rb +8 -8
  37. data/spec/br_danfe/danfe_lib/nfe_lib/document_spec.rb +2 -2
  38. data/spec/br_danfe/danfe_lib/nfe_lib/dup_spec.rb +1 -1
  39. data/spec/br_danfe/danfe_lib/nfe_lib/emit_header_spec.rb +3 -3
  40. data/spec/br_danfe/danfe_lib/nfe_lib/entrega_spec.rb +1 -1
  41. data/spec/br_danfe/danfe_lib/nfe_lib/icmstot_spec.rb +1 -1
  42. data/spec/br_danfe/danfe_lib/nfe_lib/infadic_spec.rb +1 -1
  43. data/spec/br_danfe/danfe_lib/nfe_lib/infadic_vol_spec.rb +1 -1
  44. data/spec/br_danfe/danfe_lib/nfe_lib/issqn_spec.rb +1 -1
  45. data/spec/br_danfe/danfe_lib/nfe_lib/ticket_spec.rb +3 -3
  46. data/spec/br_danfe/danfe_lib/nfe_lib/transp_spec.rb +1 -1
  47. data/spec/br_danfe/danfe_lib/nfe_lib/vol_spec.rb +1 -1
  48. data/spec/br_danfe/danfe_lib/nfe_spec.rb +6 -6
  49. data/spec/br_danfe/mdfe_lib/fisco_control_spec.rb +1 -1
  50. data/spec/br_danfe/mdfe_lib/header_spec.rb +1 -1
  51. data/spec/br_danfe/mdfe_lib/notes_spec.rb +1 -1
  52. data/spec/br_danfe/mdfe_spec.rb +2 -2
  53. data/spec/br_danfe/qr_code_spec.rb +1 -1
  54. data/spec/fixtures/cce/lib/barcode#render.pdf +14 -14
  55. data/spec/fixtures/cce/lib/correction#render.pdf +0 -0
  56. data/spec/fixtures/cce/lib/document#box.pdf +14 -14
  57. data/spec/fixtures/cce/lib/document#box.with.block.pdf +0 -0
  58. data/spec/fixtures/cce/lib/document#text.align.pdf +0 -0
  59. data/spec/fixtures/cce/lib/document#text.pad.pdf +0 -0
  60. data/spec/fixtures/cce/lib/document#text.simple.pdf +0 -0
  61. data/spec/fixtures/cce/lib/document#text.size.pdf +0 -0
  62. data/spec/fixtures/cce/lib/document#text.style.pdf +0 -0
  63. data/spec/fixtures/cce/lib/footer#render.pdf +0 -0
  64. data/spec/fixtures/cce/lib/header#render.pdf +0 -0
  65. data/spec/fixtures/cce/lib/nfe_key#render.pdf +0 -0
  66. data/spec/fixtures/cce/lib/protocol#render.pdf +0 -0
  67. data/spec/fixtures/cce/v1.00/cce.fixture.pdf +265 -149
  68. data/spec/fixtures/mdfe/lib/fisco_control#barcode.pdf +0 -0
  69. data/spec/fixtures/mdfe/lib/fisco_control#without-barcode.pdf +0 -0
  70. data/spec/fixtures/mdfe/lib/header#render-qr-code.pdf +0 -0
  71. data/spec/fixtures/mdfe/lib/header#render-with_logo.pdf +0 -0
  72. data/spec/fixtures/mdfe/lib/header#render-without-qr-code.pdf +0 -0
  73. data/spec/fixtures/mdfe/lib/header#render-without_logo.pdf +0 -0
  74. data/spec/fixtures/mdfe/lib/mdfe-with-multiple-pages.pdf +344 -176
  75. data/spec/fixtures/mdfe/lib/mdfe.fixture.pdf +336 -168
  76. data/spec/fixtures/mdfe/lib/notes#render-big-aditional-information.pdf +219 -151
  77. data/spec/fixtures/nfce/lib/document#render.pdf +20 -20
  78. data/spec/fixtures/nfce/lib/footer#render-with_additional_information.pdf +0 -0
  79. data/spec/fixtures/nfce/lib/footer#render.pdf +0 -0
  80. data/spec/fixtures/nfce/lib/header#render-homologation.pdf +0 -0
  81. data/spec/fixtures/nfce/lib/header#render-long_name_with_logo.pdf +0 -0
  82. data/spec/fixtures/nfce/lib/header#render-long_name_without_logo.pdf +0 -0
  83. data/spec/fixtures/nfce/lib/header#render-short_name_with_logo.pdf +0 -0
  84. data/spec/fixtures/nfce/lib/header#render-short_name_without_logo.pdf +0 -0
  85. data/spec/fixtures/nfce/lib/key#render.pdf +0 -0
  86. data/spec/fixtures/nfce/lib/nfce_identification#render.pdf +0 -0
  87. data/spec/fixtures/nfce/lib/product_list#render-with_many_products.pdf +0 -0
  88. data/spec/fixtures/nfce/lib/product_list#render-with_many_products_and_long_names.pdf +0 -0
  89. data/spec/fixtures/nfce/lib/product_list#render-with_single_product.pdf +0 -0
  90. data/spec/fixtures/nfce/lib/product_list#render-with_single_product_and_long_name.pdf +0 -0
  91. data/spec/fixtures/nfce/lib/recipient#render-company.pdf +0 -0
  92. data/spec/fixtures/nfce/lib/recipient#render-consumer_without_document.pdf +0 -0
  93. data/spec/fixtures/nfce/lib/recipient#render-foreign.pdf +0 -0
  94. data/spec/fixtures/nfce/lib/recipient#render-individual.pdf +0 -0
  95. data/spec/fixtures/nfce/lib/recipient#render-unidentified_consumer.pdf +0 -0
  96. data/spec/fixtures/nfce/lib/total_list#does_not_render-payment_methods.pdf +0 -0
  97. data/spec/fixtures/nfce/lib/total_list#render-grouped_payment_methods.pdf +0 -0
  98. data/spec/fixtures/nfce/lib/total_list#render-totals.pdf +0 -0
  99. data/spec/fixtures/nfce/lib/total_list#render-without_payment.pdf +0 -0
  100. data/spec/fixtures/nfce/lib/total_list#render.pdf +0 -0
  101. data/spec/fixtures/nfce/v4.00/multiples_xmls_on_the_same_pdf.pdf +336 -205
  102. data/spec/fixtures/nfce/v4.00/nfce-unauthorized-hom.fixture.pdf +0 -0
  103. data/spec/fixtures/nfce/v4.00/nfce-unauthorized-prod.fixture.pdf +0 -0
  104. data/spec/fixtures/nfce/v4.00/rendered_nfce.fixture.pdf +0 -0
  105. data/spec/fixtures/nfce/v4.00/saved_nfce.fixture.pdf +0 -0
  106. data/spec/fixtures/nfe/lib/dest#render-v2.00.pdf +0 -0
  107. data/spec/fixtures/nfe/lib/dest#render-v3.10.pdf +0 -0
  108. data/spec/fixtures/nfe/lib/dest#render-v4.00.pdf +0 -0
  109. data/spec/fixtures/nfe/lib/dest#render-with-address-bigger.pdf +0 -0
  110. data/spec/fixtures/nfe/lib/dest#render-with_cnpj.pdf +0 -0
  111. data/spec/fixtures/nfe/lib/dest#render-with_cpf.pdf +0 -0
  112. data/spec/fixtures/nfe/lib/dest#render-with_ie.pdf +0 -0
  113. data/spec/fixtures/nfe/lib/dest#render-without-address-complement.pdf +0 -0
  114. data/spec/fixtures/nfe/lib/det_body#render-csosn.pdf +144 -82
  115. data/spec/fixtures/nfe/lib/det_body#render-cst.pdf +129 -81
  116. data/spec/fixtures/nfe/lib/det_body#render-fci.pdf +124 -85
  117. data/spec/fixtures/nfe/lib/det_body#render-icms_st.pdf +133 -89
  118. data/spec/fixtures/nfe/lib/det_body#render-quantity_with_custom_precision.pdf +122 -84
  119. data/spec/fixtures/nfe/lib/det_body#render-three_pages.pdf +140 -85
  120. data/spec/fixtures/nfe/lib/det_body#render-two_pages.pdf +140 -85
  121. data/spec/fixtures/nfe/lib/det_body#render-unit_price_with_custom_precision.pdf +122 -84
  122. data/spec/fixtures/nfe/lib/det_body#render-with_entrega.pdf +118 -64
  123. data/spec/fixtures/nfe/lib/det_body#render-with_infadprod.pdf +131 -76
  124. data/spec/fixtures/nfe/lib/det_body#render-with_issqn.pdf +140 -85
  125. data/spec/fixtures/nfe/lib/det_body#render-without_issqn.pdf +140 -85
  126. data/spec/fixtures/nfe/lib/document#lcnpj-blank.pdf +0 -0
  127. data/spec/fixtures/nfe/lib/document#lcnpj-invalid.pdf +0 -0
  128. data/spec/fixtures/nfe/lib/document#lcnpj-valid.pdf +0 -0
  129. data/spec/fixtures/nfe/lib/document#lie-blank-uf-invalid.pdf +0 -0
  130. data/spec/fixtures/nfe/lib/document#lie-blank.pdf +0 -0
  131. data/spec/fixtures/nfe/lib/document#lie-invalid.pdf +0 -0
  132. data/spec/fixtures/nfe/lib/document#lie-valid.pdf +0 -0
  133. data/spec/fixtures/nfe/lib/dup#render-with_entrega.pdf +0 -0
  134. data/spec/fixtures/nfe/lib/dup#render.pdf +0 -0
  135. data/spec/fixtures/nfe/lib/emit_header#render-nfe_key.pdf +283 -151
  136. data/spec/fixtures/nfe/lib/emit_header#render-second_page.pdf +283 -151
  137. data/spec/fixtures/nfe/lib/emit_header#render-with_logo.pdf +283 -151
  138. data/spec/fixtures/nfe/lib/emit_header#render-without_logo.pdf +264 -132
  139. data/spec/fixtures/nfe/lib/entrega#render-v2.00.pdf +0 -0
  140. data/spec/fixtures/nfe/lib/entrega#render-with-address-bigger.pdf +0 -0
  141. data/spec/fixtures/nfe/lib/entrega#render-with_cpf.pdf +0 -0
  142. data/spec/fixtures/nfe/lib/icmstot#render-with_entrega.pdf +0 -0
  143. data/spec/fixtures/nfe/lib/icmstot#render.pdf +0 -0
  144. data/spec/fixtures/nfe/lib/infadic#render-all_the_informations.pdf +0 -0
  145. data/spec/fixtures/nfe/lib/infadic#render-difal.pdf +0 -0
  146. data/spec/fixtures/nfe/lib/infadic#render-extra_volume.pdf +0 -0
  147. data/spec/fixtures/nfe/lib/infadic#render-with_complementary_information.pdf +0 -0
  148. data/spec/fixtures/nfe/lib/infadic#render-with_dup_additional_information.pdf +0 -0
  149. data/spec/fixtures/nfe/lib/infadic#render-with_fisco_additional_information.pdf +0 -0
  150. data/spec/fixtures/nfe/lib/infadic#render-with_street_data.pdf +0 -0
  151. data/spec/fixtures/nfe/lib/infadic#render-without_dup_additional_information.pdf +0 -0
  152. data/spec/fixtures/nfe/lib/infadic#render.pdf +0 -0
  153. data/spec/fixtures/nfe/lib/infadic_vol#render-extra_volume.pdf +0 -0
  154. data/spec/fixtures/nfe/lib/issqn#render-with_entrega.pdf +0 -0
  155. data/spec/fixtures/nfe/lib/issqn#render-with_issqn.pdf +0 -0
  156. data/spec/fixtures/nfe/lib/issqn#render-with_one_issqn_value.pdf +0 -0
  157. data/spec/fixtures/nfe/lib/issqn#render-without_issqn.pdf +14 -14
  158. data/spec/fixtures/nfe/lib/ticket#render.pdf +0 -0
  159. data/spec/fixtures/nfe/lib/ticket#render_with_dEmit.pdf +0 -0
  160. data/spec/fixtures/nfe/lib/ticket#render_with_dhEmit.pdf +0 -0
  161. data/spec/fixtures/nfe/lib/transp#render-modfrete_0.pdf +0 -0
  162. data/spec/fixtures/nfe/lib/transp#render-modfrete_1.pdf +0 -0
  163. data/spec/fixtures/nfe/lib/transp#render-modfrete_2.pdf +0 -0
  164. data/spec/fixtures/nfe/lib/transp#render-modfrete_3.pdf +0 -0
  165. data/spec/fixtures/nfe/lib/transp#render-modfrete_4.pdf +0 -0
  166. data/spec/fixtures/nfe/lib/transp#render-modfrete_9.pdf +0 -0
  167. data/spec/fixtures/nfe/lib/transp#render-with_entrega.pdf +0 -0
  168. data/spec/fixtures/nfe/lib/transp#render.pdf +0 -0
  169. data/spec/fixtures/nfe/lib/vol#render-blank-boxes.pdf +0 -0
  170. data/spec/fixtures/nfe/lib/vol#render-with_entrega.pdf +0 -0
  171. data/spec/fixtures/nfe/lib/vol#render.pdf +0 -0
  172. data/spec/fixtures/nfe/v2.00/custom_options.fixture.pdf +312 -185
  173. data/spec/fixtures/nfe/v2.00/nfe_simples_nacional.xml.fixture.pdf +293 -166
  174. data/spec/fixtures/nfe/v2.00/nfe_with_entrega.xml.fixture.pdf +296 -166
  175. data/spec/fixtures/nfe/v2.00/nfe_with_extra_volumes.xml.fixture.pdf +419 -221
  176. data/spec/fixtures/nfe/v2.00/nfe_with_fci.xml.fixture.pdf +311 -163
  177. data/spec/fixtures/nfe/v2.00/nfe_with_ns.xml.fixture.pdf +309 -171
  178. data/spec/fixtures/nfe/v2.00/nfe_without_ns.xml.fixture.pdf +303 -152
  179. data/spec/fixtures/nfe/v3.10/multiples.xmls.on.the.same.pdf.pdf +320 -152
  180. data/spec/fixtures/nfe/v3.10/nfe_simples_nacional.xml.fixture.pdf +312 -144
  181. data/spec/fixtures/nfe/v3.10/with_footer.fixture.pdf +323 -169
  182. data/spec/fixtures/nfe/v3.10/with_issqn.fixture.pdf +314 -138
  183. data/spec/fixtures/nfe/v3.10/with_three_pages.fixture.pdf +330 -159
  184. data/spec/fixtures/nfe/v3.10/without_issqn.fixture.pdf +319 -148
  185. data/spec/fixtures/qr_code/qr_code#render.pdf +0 -0
  186. metadata +7 -160
@@ -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
@@ -117,7 +117,7 @@ describe BrDanfe::DanfeLib::NfeLib::Document do
117
117
  describe '#lcnpj' 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
@@ -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
@@ -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
@@ -6,14 +6,14 @@
6
6
  >>
7
7
  endobj
8
8
  2 0 obj
9
- << /Type /Catalog
10
- /Pages 3 0 R
9
+ << /Pages 3 0 R
10
+ /Type /Catalog
11
11
  >>
12
12
  endobj
13
13
  3 0 obj
14
- << /Type /Pages
15
- /Count 1
14
+ << /Count 1
16
15
  /Kids [5 0 R]
16
+ /Type /Pages
17
17
  >>
18
18
  endobj
19
19
  4 0 obj
@@ -487,17 +487,17 @@ Q
487
487
  endstream
488
488
  endobj
489
489
  5 0 obj
490
- << /Type /Page
491
- /Parent 3 0 R
492
- /MediaBox [0 0 595.28 841.89]
493
- /CropBox [0 0 595.28 841.89]
490
+ << /ArtBox [0 0 595.28 841.89]
494
491
  /BleedBox [0 0 595.28 841.89]
495
- /TrimBox [0 0 595.28 841.89]
496
- /ArtBox [0 0 595.28 841.89]
497
492
  /Contents 4 0 R
498
- /Resources << /ProcSet [/PDF /Text /ImageB /ImageC /ImageI]
499
- /Font << >>
493
+ /CropBox [0 0 595.28 841.89]
494
+ /MediaBox [0 0 595.28 841.89]
495
+ /Parent 3 0 R
496
+ /Resources << /Font << >>
497
+ /ProcSet [/PDF /Text /ImageB /ImageC /ImageI]
500
498
  >>
499
+ /TrimBox [0 0 595.28 841.89]
500
+ /Type /Page
501
501
  >>
502
502
  endobj
503
503
  xref
@@ -509,9 +509,9 @@ xref
509
509
  0000000215 00000 n
510
510
  0000006108 00000 n
511
511
  trailer
512
- << /Size 6
512
+ << /Info 1 0 R
513
513
  /Root 2 0 R
514
- /Info 1 0 R
514
+ /Size 6
515
515
  >>
516
516
  startxref
517
517
  6392
@@ -6,14 +6,14 @@
6
6
  >>
7
7
  endobj
8
8
  2 0 obj
9
- << /Type /Catalog
10
- /Pages 3 0 R
9
+ << /Pages 3 0 R
10
+ /Type /Catalog
11
11
  >>
12
12
  endobj
13
13
  3 0 obj
14
- << /Type /Pages
15
- /Count 1
14
+ << /Count 1
16
15
  /Kids [5 0 R]
16
+ /Type /Pages
17
17
  >>
18
18
  endobj
19
19
  4 0 obj
@@ -29,17 +29,17 @@ Q
29
29
  endstream
30
30
  endobj
31
31
  5 0 obj
32
- << /Type /Page
33
- /Parent 3 0 R
34
- /MediaBox [0 0 595.28 841.89]
35
- /CropBox [0 0 595.28 841.89]
32
+ << /ArtBox [0 0 595.28 841.89]
36
33
  /BleedBox [0 0 595.28 841.89]
37
- /TrimBox [0 0 595.28 841.89]
38
- /ArtBox [0 0 595.28 841.89]
39
34
  /Contents 4 0 R
40
- /Resources << /ProcSet [/PDF /Text /ImageB /ImageC /ImageI]
41
- /Font << >>
35
+ /CropBox [0 0 595.28 841.89]
36
+ /MediaBox [0 0 595.28 841.89]
37
+ /Parent 3 0 R
38
+ /Resources << /Font << >>
39
+ /ProcSet [/PDF /Text /ImageB /ImageC /ImageI]
42
40
  >>
41
+ /TrimBox [0 0 595.28 841.89]
42
+ /Type /Page
43
43
  >>
44
44
  endobj
45
45
  xref
@@ -51,9 +51,9 @@ xref
51
51
  0000000215 00000 n
52
52
  0000000304 00000 n
53
53
  trailer
54
- << /Size 6
54
+ << /Info 1 0 R
55
55
  /Root 2 0 R
56
- /Info 1 0 R
56
+ /Size 6
57
57
  >>
58
58
  startxref
59
59
  588