br_danfe 0.15.1 → 0.17.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (132) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +20 -8
  3. data/.github/dependabot.yml +19 -0
  4. data/.rubocop.yml +24 -11
  5. data/.tool-versions +1 -0
  6. data/Gemfile.lock +69 -50
  7. data/Guardfile +4 -2
  8. data/README.md +23 -0
  9. data/bin/_guard-core +29 -0
  10. data/bin/guard +29 -0
  11. data/br_danfe.gemspec +9 -7
  12. data/lib/br_danfe/danfe_lib/nfce.rb +11 -9
  13. data/lib/br_danfe/danfe_lib/nfce_lib/document.rb +1 -1
  14. data/lib/br_danfe/danfe_lib/nfce_lib/footer.rb +2 -2
  15. data/lib/br_danfe/danfe_lib/nfce_lib/header.rb +30 -16
  16. data/lib/br_danfe/danfe_lib/nfce_lib/key.rb +3 -3
  17. data/lib/br_danfe/danfe_lib/nfce_lib/nfce_identification.rb +3 -3
  18. data/lib/br_danfe/danfe_lib/nfce_lib/product_list.rb +44 -53
  19. data/lib/br_danfe/danfe_lib/nfce_lib/recipient.rb +1 -1
  20. data/lib/br_danfe/danfe_lib/nfce_lib/total_list.rb +16 -15
  21. data/lib/br_danfe/danfe_lib/nfe.rb +11 -9
  22. data/lib/br_danfe/danfe_lib/nfe_lib/dest.rb +1 -1
  23. data/lib/br_danfe/danfe_lib/nfe_lib/dup.rb +1 -2
  24. data/lib/br_danfe/danfe_lib/nfe_lib/emit_header.rb +5 -6
  25. data/lib/br_danfe/danfe_lib/nfe_lib/infadic.rb +2 -1
  26. data/lib/br_danfe/document_builder.rb +1 -1
  27. data/lib/br_danfe/helper.rb +8 -10
  28. data/lib/br_danfe/mdfe.rb +55 -0
  29. data/lib/br_danfe/mdfe_lib/authorization_protocol.rb +24 -0
  30. data/lib/br_danfe/mdfe_lib/document.rb +26 -0
  31. data/lib/br_danfe/mdfe_lib/drivers.rb +70 -0
  32. data/lib/br_danfe/mdfe_lib/fisco_control.rb +21 -0
  33. data/lib/br_danfe/mdfe_lib/header.rb +77 -0
  34. data/lib/br_danfe/mdfe_lib/mdfe_identification.rb +69 -0
  35. data/lib/br_danfe/mdfe_lib/notes.rb +94 -0
  36. data/lib/br_danfe/mdfe_lib/totalizer.rb +57 -0
  37. data/lib/br_danfe/mdfe_lib/vehicles.rb +80 -0
  38. data/lib/br_danfe/qr_code.rb +21 -0
  39. data/lib/br_danfe/version.rb +1 -1
  40. data/lib/br_danfe.rb +2 -2
  41. data/spec/br_danfe/danfe_lib/nfce_lib/footer_spec.rb +3 -2
  42. data/spec/br_danfe/danfe_lib/nfce_lib/header_spec.rb +6 -4
  43. data/spec/br_danfe/danfe_lib/nfce_lib/helper_spec.rb +2 -2
  44. data/spec/br_danfe/danfe_lib/nfce_lib/key_spec.rb +2 -2
  45. data/spec/br_danfe/danfe_lib/nfce_lib/nfce_identification_spec.rb +2 -2
  46. data/spec/br_danfe/danfe_lib/nfce_lib/recipient_spec.rb +10 -10
  47. data/spec/br_danfe/danfe_lib/nfce_lib/total_list_spec.rb +12 -12
  48. data/spec/br_danfe/danfe_lib/nfce_spec.rb +2 -1
  49. data/spec/br_danfe/danfe_lib/nfe_lib/cst_spec.rb +4 -4
  50. data/spec/br_danfe/danfe_lib/nfe_lib/dest_spec.rb +178 -178
  51. data/spec/br_danfe/danfe_lib/nfe_lib/det_body_spec.rb +274 -274
  52. data/spec/br_danfe/danfe_lib/nfe_lib/document_spec.rb +77 -77
  53. data/spec/br_danfe/danfe_lib/nfe_lib/dup_spec.rb +23 -23
  54. data/spec/br_danfe/danfe_lib/nfe_lib/emit_header_spec.rb +37 -37
  55. data/spec/br_danfe/danfe_lib/nfe_lib/helper_spec.rb +34 -34
  56. data/spec/br_danfe/danfe_lib/nfe_lib/icmstot_spec.rb +19 -19
  57. data/spec/br_danfe/danfe_lib/nfe_lib/infadic_spec.rb +240 -240
  58. data/spec/br_danfe/danfe_lib/nfe_lib/infadic_vol_spec.rb +3 -2
  59. data/spec/br_danfe/danfe_lib/nfe_lib/issqn_spec.rb +16 -16
  60. data/spec/br_danfe/danfe_lib/nfe_lib/ticket_spec.rb +13 -13
  61. data/spec/br_danfe/danfe_lib/nfe_lib/transp_spec.rb +76 -76
  62. data/spec/br_danfe/danfe_lib/nfe_lib/vol_spec.rb +40 -40
  63. data/spec/br_danfe/danfe_lib/nfe_lib/xprod_spec.rb +118 -118
  64. data/spec/br_danfe/danfe_spec.rb +2 -2
  65. data/spec/br_danfe/helper_spec.rb +26 -14
  66. data/spec/br_danfe/mdfe_lib/authorization_protocol_spec.rb +35 -0
  67. data/spec/br_danfe/mdfe_lib/document_spec.rb +20 -0
  68. data/spec/br_danfe/mdfe_lib/drivers_spec.rb +88 -0
  69. data/spec/br_danfe/mdfe_lib/fisco_control_spec.rb +69 -0
  70. data/spec/br_danfe/mdfe_lib/header_spec.rb +135 -0
  71. data/spec/br_danfe/mdfe_lib/mdfe_identification_spec.rb +104 -0
  72. data/spec/br_danfe/mdfe_lib/notes_spec.rb +97 -0
  73. data/spec/br_danfe/mdfe_lib/totalizer_spec.rb +63 -0
  74. data/spec/br_danfe/mdfe_lib/vehicles_spec.rb +66 -0
  75. data/spec/br_danfe/mdfe_spec.rb +45 -0
  76. data/spec/br_danfe/qr_code_spec.rb +31 -0
  77. data/spec/br_danfe/xml_spec.rb +6 -6
  78. data/spec/fixtures/mdfe/lib/document#render.pdf +0 -0
  79. data/spec/fixtures/mdfe/lib/document#text.align.pdf +0 -0
  80. data/spec/fixtures/mdfe/lib/document#text.pad.pdf +0 -0
  81. data/spec/fixtures/mdfe/lib/document#text.simple.pdf +0 -0
  82. data/spec/fixtures/mdfe/lib/document#text.size.pdf +0 -0
  83. data/spec/fixtures/mdfe/lib/document#text.style.pdf +0 -0
  84. data/spec/fixtures/mdfe/lib/fisco_control#barcode.pdf +0 -0
  85. data/spec/fixtures/mdfe/lib/fisco_control#without-barcode.pdf +0 -0
  86. data/spec/fixtures/mdfe/lib/header#render-qr-code.pdf +0 -0
  87. data/spec/fixtures/mdfe/lib/header#render-with_logo.pdf +0 -0
  88. data/spec/fixtures/mdfe/lib/header#render-without-qr-code.pdf +0 -0
  89. data/spec/fixtures/mdfe/lib/header#render-without_logo.pdf +0 -0
  90. data/spec/fixtures/mdfe/lib/mdfe-with-multiple-pages.pdf +1945 -0
  91. data/spec/fixtures/mdfe/lib/mdfe.fixture.pdf +1286 -0
  92. data/spec/fixtures/mdfe/lib/notes#render-big-aditional-information.pdf +1943 -0
  93. data/spec/fixtures/mdfe/lib/xml-mdfe-multiples-pages.xml +116 -0
  94. data/spec/fixtures/mdfe/lib/xml-mdfe.xml +250 -0
  95. data/spec/fixtures/nfce/lib/document#render.pdf +12 -23
  96. data/spec/fixtures/nfce/lib/footer#render-with_additional_information.pdf +0 -0
  97. data/spec/fixtures/nfce/lib/footer#render.pdf +0 -0
  98. data/spec/fixtures/nfce/lib/header#render-homologation.pdf +0 -0
  99. data/spec/fixtures/nfce/lib/header#render-long_name_with_logo.pdf +0 -0
  100. data/spec/fixtures/nfce/lib/header#render-long_name_without_logo.pdf +0 -0
  101. data/spec/fixtures/nfce/lib/header#render-short_name_with_logo.pdf +0 -0
  102. data/spec/fixtures/nfce/lib/header#render-short_name_without_logo.pdf +0 -0
  103. data/spec/fixtures/nfce/lib/key#render.pdf +0 -0
  104. data/spec/fixtures/nfce/lib/nfce_identification#render.pdf +0 -0
  105. data/spec/fixtures/nfce/lib/product_list#render-with_many_products.pdf +0 -0
  106. data/spec/fixtures/nfce/lib/product_list#render-with_many_products_and_long_names.pdf +0 -0
  107. data/spec/fixtures/nfce/lib/product_list#render-with_single_product.pdf +0 -0
  108. data/spec/fixtures/nfce/lib/product_list#render-with_single_product_and_long_name.pdf +0 -0
  109. data/spec/fixtures/nfce/lib/product_list_with_many_products_and_long_names.xml +2 -2
  110. data/spec/fixtures/nfce/lib/product_list_with_single_product_and_long_name.xml +1 -1
  111. data/spec/fixtures/nfce/lib/recipient#render-company.pdf +0 -0
  112. data/spec/fixtures/nfce/lib/recipient#render-consumer_without_document.pdf +0 -0
  113. data/spec/fixtures/nfce/lib/recipient#render-foreign.pdf +0 -0
  114. data/spec/fixtures/nfce/lib/recipient#render-individual.pdf +0 -0
  115. data/spec/fixtures/nfce/lib/recipient#render-unidentified_consumer.pdf +0 -0
  116. data/spec/fixtures/nfce/lib/total_list#does_not_render-payment_methods.pdf +0 -0
  117. data/spec/fixtures/nfce/lib/total_list#render-grouped_payment_methods.pdf +0 -0
  118. data/spec/fixtures/nfce/lib/total_list#render-totals.pdf +0 -0
  119. data/spec/fixtures/nfce/lib/total_list#render-without_payment.pdf +0 -0
  120. data/spec/fixtures/nfce/lib/total_list#render.pdf +0 -0
  121. data/spec/fixtures/nfce/v4.00/multiples_xmls_on_the_same_pdf.pdf +568 -447
  122. data/spec/fixtures/nfce/v4.00/nfce-unauthorized-hom.fixture.pdf +0 -0
  123. data/spec/fixtures/nfce/v4.00/nfce-unauthorized-prod.fixture.pdf +0 -0
  124. data/spec/fixtures/nfce/v4.00/rendered_nfce.fixture.pdf +0 -0
  125. data/spec/fixtures/nfce/v4.00/saved_nfce.fixture.pdf +0 -0
  126. data/spec/fixtures/qr_code/qr_code#render.pdf +0 -0
  127. data/spec/spec_helper.rb +1 -1
  128. metadata +118 -48
  129. data/lib/br_danfe/danfe_lib/nfce_lib/qr_code.rb +0 -25
  130. data/lib/br_danfe/danfe_lib/nfe_lib/cep.rb +0 -11
  131. data/spec/br_danfe/danfe_lib/nfce_lib/qr_code_spec.rb +0 -35
  132. data/spec/br_danfe/danfe_lib/nfe_lib/cep_spec.rb +0 -10
@@ -19,7 +19,7 @@ describe BrDanfe::DanfeLib::NfeLib::Infadic do
19
19
 
20
20
  context 'when there is no information' do
21
21
  let(:xml_as_string) do
22
- <<-EOS
22
+ <<~XML
23
23
  <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
24
24
  <infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
25
25
  <transp>
@@ -56,7 +56,7 @@ describe BrDanfe::DanfeLib::NfeLib::Infadic do
56
56
  </total>
57
57
  </infNFe>
58
58
  </NFe>
59
- EOS
59
+ XML
60
60
  end
61
61
 
62
62
  it 'renders title with box, subtitle and fisco box on the pdf' do
@@ -70,7 +70,7 @@ describe BrDanfe::DanfeLib::NfeLib::Infadic do
70
70
 
71
71
  context 'when has difal' do
72
72
  let(:xml_as_string) do
73
- <<-EOS
73
+ <<~XML
74
74
  <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
75
75
  <infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
76
76
  <transp>
@@ -108,7 +108,7 @@ describe BrDanfe::DanfeLib::NfeLib::Infadic do
108
108
  </total>
109
109
  </infNFe>
110
110
  </NFe>
111
- EOS
111
+ XML
112
112
  end
113
113
 
114
114
  it 'renders title with box, subtitle, fisco box and difal on the pdf' do
@@ -122,35 +122,35 @@ describe BrDanfe::DanfeLib::NfeLib::Infadic do
122
122
 
123
123
  context 'when has too big address' do
124
124
  let(:xml_as_string) do
125
- <<-EOS
126
- <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
127
- <infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
128
- <ide>
129
- <dEmi>2011-10-29</dEmi>
130
- <dSaiEnt>2011-10-30</dSaiEnt>
131
- <hSaiEnt>15:32:45</hSaiEnt>
132
- </ide>
133
- <dest>
134
- <CNPJ>82743287000880</CNPJ>
135
- <xNome>Schneider Electric Brasil Ltda</xNome>
136
- <enderDest>
137
- <xLgr>Av da Saudade</xLgr>
138
- <nro>1125</nro>
139
- <xBairro>Frutal</xBairro>
140
- <xCpl>Em anexo ao super mercado maior do bairro</xCpl>
141
- <cMun>3552403</cMun>
142
- <xMun>SUMARE</xMun>
143
- <UF>SP</UF>
144
- <CEP>13171320</CEP>
145
- <cPais>1058</cPais>
146
- <xPais>BRASIL</xPais>
147
- <fone>1921046300</fone>
148
- </enderDest>
149
- <IE>671008375110</IE>
150
- </dest>
151
- </infNFe>
152
- </NFe>
153
- EOS
125
+ <<~XML
126
+ <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
127
+ <infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
128
+ <ide>
129
+ <dEmi>2011-10-29</dEmi>
130
+ <dSaiEnt>2011-10-30</dSaiEnt>
131
+ <hSaiEnt>15:32:45</hSaiEnt>
132
+ </ide>
133
+ <dest>
134
+ <CNPJ>82743287000880</CNPJ>
135
+ <xNome>Schneider Electric Brasil Ltda</xNome>
136
+ <enderDest>
137
+ <xLgr>Av da Saudade</xLgr>
138
+ <nro>1125</nro>
139
+ <xBairro>Frutal</xBairro>
140
+ <xCpl>Em anexo ao super mercado maior do bairro</xCpl>
141
+ <cMun>3552403</cMun>
142
+ <xMun>SUMARE</xMun>
143
+ <UF>SP</UF>
144
+ <CEP>13171320</CEP>
145
+ <cPais>1058</cPais>
146
+ <xPais>BRASIL</xPais>
147
+ <fone>1921046300</fone>
148
+ </enderDest>
149
+ <IE>671008375110</IE>
150
+ </dest>
151
+ </infNFe>
152
+ </NFe>
153
+ XML
154
154
  end
155
155
 
156
156
  it 'renders title with box, subtitle, fisco box and address on the pdf' do
@@ -164,71 +164,71 @@ describe BrDanfe::DanfeLib::NfeLib::Infadic do
164
164
 
165
165
  context 'when has complementary information' do
166
166
  let(:xml_as_string) do
167
- <<-EOS
168
- <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
169
- <infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
170
- <ide>
171
- <dEmi>2011-10-29</dEmi>
172
- <dSaiEnt>2011-10-30</dSaiEnt>
173
- <hSaiEnt>15:32:45</hSaiEnt>
174
- </ide>
175
- <dest>
176
- <CNPJ>82743287000880</CNPJ>
177
- <xNome>Schneider Electric Brasil Ltda</xNome>
178
- <enderDest>
179
- <xLgr>Av da Saudade</xLgr>
180
- <nro>1125</nro>
181
- <xBairro>Frutal</xBairro>
182
- <xCpl>Sala 01 e 02</xCpl>
183
- <cMun>3552403</cMun>
184
- <xMun>SUMARE</xMun>
185
- <UF>SP</UF>
186
- <CEP>13171320</CEP>
187
- <cPais>1058</cPais>
188
- <xPais>BRASIL</xPais>
189
- <fone>1921046300</fone>
190
- </enderDest>
191
- <IE>671008375110</IE>
192
- </dest>
193
- <transp>
194
- <vol>
195
- <qVol>1</qVol>
196
- <esp>VOLUMES 1</esp>
197
- <marca>DIVERSOS 1</marca>
198
- <nVol>1</nVol>
199
- <pesoL>1000.000</pesoL>
200
- <pesoB>1100.000</pesoB>
201
- </vol>
202
- <vol>
203
- <qVol>2</qVol>
204
- <esp>VOLUMES 2</esp>
205
- <marca>DIVERSOS 2</marca>
206
- <nVol>2</nVol>
207
- <pesoL>2000.000</pesoL>
208
- <pesoB>2200.000</pesoB>
209
- </vol>
210
- <vol>
211
- <qVol>3</qVol>
212
- <esp>VOLUMES 3</esp>
213
- <marca>DIVERSOS 3</marca>
214
- <nVol>3</nVol>
215
- <pesoL>3000.000</pesoL>
216
- <pesoB>3300.000</pesoB>
217
- </vol>
218
- </transp>
219
- <infAdic>
220
- <infCpl>Uma observação</infCpl>
221
- </infAdic>
222
- <total>
223
- <ICMSTot>
224
- <vFCPUFDest>0.00</vFCPUFDest>
225
- <vICMSUFDest>0.00</vICMSUFDest>
226
- <vICMSUFRemet>0.00</vICMSUFRemet>
227
- </ICMSTot>
228
- </total>
229
- </infNFe>
230
- </NFe>
231
- EOS
167
+ <<~XML
168
+ <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
169
+ <infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
170
+ <ide>
171
+ <dEmi>2011-10-29</dEmi>
172
+ <dSaiEnt>2011-10-30</dSaiEnt>
173
+ <hSaiEnt>15:32:45</hSaiEnt>
174
+ </ide>
175
+ <dest>
176
+ <CNPJ>82743287000880</CNPJ>
177
+ <xNome>Schneider Electric Brasil Ltda</xNome>
178
+ <enderDest>
179
+ <xLgr>Av da Saudade</xLgr>
180
+ <nro>1125</nro>
181
+ <xBairro>Frutal</xBairro>
182
+ <xCpl>Sala 01 e 02</xCpl>
183
+ <cMun>3552403</cMun>
184
+ <xMun>SUMARE</xMun>
185
+ <UF>SP</UF>
186
+ <CEP>13171320</CEP>
187
+ <cPais>1058</cPais>
188
+ <xPais>BRASIL</xPais>
189
+ <fone>1921046300</fone>
190
+ </enderDest>
191
+ <IE>671008375110</IE>
192
+ </dest>
193
+ <transp>
194
+ <vol>
195
+ <qVol>1</qVol>
196
+ <esp>VOLUMES 1</esp>
197
+ <marca>DIVERSOS 1</marca>
198
+ <nVol>1</nVol>
199
+ <pesoL>1000.000</pesoL>
200
+ <pesoB>1100.000</pesoB>
201
+ </vol>
202
+ <vol>
203
+ <qVol>2</qVol>
204
+ <esp>VOLUMES 2</esp>
205
+ <marca>DIVERSOS 2</marca>
206
+ <nVol>2</nVol>
207
+ <pesoL>2000.000</pesoL>
208
+ <pesoB>2200.000</pesoB>
209
+ </vol>
210
+ <vol>
211
+ <qVol>3</qVol>
212
+ <esp>VOLUMES 3</esp>
213
+ <marca>DIVERSOS 3</marca>
214
+ <nVol>3</nVol>
215
+ <pesoL>3000.000</pesoL>
216
+ <pesoB>3300.000</pesoB>
217
+ </vol>
218
+ </transp>
219
+ <infAdic>
220
+ <infCpl>Uma observação</infCpl>
221
+ </infAdic>
222
+ <total>
223
+ <ICMSTot>
224
+ <vFCPUFDest>0.00</vFCPUFDest>
225
+ <vICMSUFDest>0.00</vICMSUFDest>
226
+ <vICMSUFRemet>0.00</vICMSUFRemet>
227
+ </ICMSTot>
228
+ </total>
229
+ </infNFe>
230
+ </NFe>
231
+ XML
232
232
  end
233
233
 
234
234
  it 'renders title with box, subtitle, fisco box and complementary information on the pdf' do
@@ -242,7 +242,7 @@ describe BrDanfe::DanfeLib::NfeLib::Infadic do
242
242
 
243
243
  context 'when has additional fisco information' do
244
244
  let(:xml_as_string) do
245
- <<-EOS
245
+ <<~XML
246
246
  <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
247
247
  <infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
248
248
  <infAdic>
@@ -250,7 +250,7 @@ describe BrDanfe::DanfeLib::NfeLib::Infadic do
250
250
  </infAdic>
251
251
  </infNFe>
252
252
  </NFe>
253
- EOS
253
+ XML
254
254
  end
255
255
 
256
256
  it 'renders title with box, subtitle, fisco box and additional information about fisco on the pdf' do
@@ -264,73 +264,73 @@ describe BrDanfe::DanfeLib::NfeLib::Infadic do
264
264
 
265
265
  context 'when has extra volume' do
266
266
  let(:xml_as_string) do
267
- <<-EOS
268
- <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
269
- <infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
270
- <ide>
271
- <dEmi>2011-10-29</dEmi>
272
- <dSaiEnt>2011-10-30</dSaiEnt>
273
- <hSaiEnt>15:32:45</hSaiEnt>
274
- </ide>
275
- <dest>
276
- <CNPJ>82743287000880</CNPJ>
277
- <xNome>Schneider Electric Brasil Ltda</xNome>
278
- <enderDest>
279
- <xLgr>Av da Saudade</xLgr>
280
- <nro>1125</nro>
281
- <xBairro>Frutal</xBairro>
282
- <xCpl>Sala 01 e 02</xCpl>
283
- <cMun>3552403</cMun>
284
- <xMun>SUMARE</xMun>
285
- <UF>SP</UF>
286
- <CEP>13171320</CEP>
287
- <cPais>1058</cPais>
288
- <xPais>BRASIL</xPais>
289
- <fone>1921046300</fone>
290
- </enderDest>
291
- <IE>671008375110</IE>
292
- </dest>
293
- <transp>
294
- <vol>
295
- <qVol>1</qVol>
296
- <esp>VOLUMES 1</esp>
297
- <marca>DIVERSOS 1</marca>
298
- <nVol>1</nVol>
299
- <pesoL>1000.000</pesoL>
300
- <pesoB>1100.000</pesoB>
301
- </vol>
302
- <vol>
303
- <qVol>2</qVol>
304
- <esp>VOLUMES 2</esp>
305
- <marca>DIVERSOS 2</marca>
306
- <nVol>2</nVol>
307
- <pesoL>2000.000</pesoL>
308
- <pesoB>2200.000</pesoB>
309
- </vol>
310
- <vol>
311
- <qVol>3</qVol>
312
- <esp>VOLUMES 3</esp>
313
- <marca>DIVERSOS 3</marca>
314
- <nVol>3</nVol>
315
- <pesoL>3000.000</pesoL>
316
- <pesoB>3300.000</pesoB>
317
- </vol>
318
- </transp>
319
- <total>
320
- <ICMSTot>
321
- <vFCPUFDest>0.00</vFCPUFDest>
322
- <vICMSUFDest>0.00</vICMSUFDest>
323
- <vICMSUFRemet>0.00</vICMSUFRemet>
324
- </ICMSTot>
325
- </total>
326
- </infNFe>
327
- </NFe>
328
- EOS
267
+ <<~XML
268
+ <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
269
+ <infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
270
+ <ide>
271
+ <dEmi>2011-10-29</dEmi>
272
+ <dSaiEnt>2011-10-30</dSaiEnt>
273
+ <hSaiEnt>15:32:45</hSaiEnt>
274
+ </ide>
275
+ <dest>
276
+ <CNPJ>82743287000880</CNPJ>
277
+ <xNome>Schneider Electric Brasil Ltda</xNome>
278
+ <enderDest>
279
+ <xLgr>Av da Saudade</xLgr>
280
+ <nro>1125</nro>
281
+ <xBairro>Frutal</xBairro>
282
+ <xCpl>Sala 01 e 02</xCpl>
283
+ <cMun>3552403</cMun>
284
+ <xMun>SUMARE</xMun>
285
+ <UF>SP</UF>
286
+ <CEP>13171320</CEP>
287
+ <cPais>1058</cPais>
288
+ <xPais>BRASIL</xPais>
289
+ <fone>1921046300</fone>
290
+ </enderDest>
291
+ <IE>671008375110</IE>
292
+ </dest>
293
+ <transp>
294
+ <vol>
295
+ <qVol>1</qVol>
296
+ <esp>VOLUMES 1</esp>
297
+ <marca>DIVERSOS 1</marca>
298
+ <nVol>1</nVol>
299
+ <pesoL>1000.000</pesoL>
300
+ <pesoB>1100.000</pesoB>
301
+ </vol>
302
+ <vol>
303
+ <qVol>2</qVol>
304
+ <esp>VOLUMES 2</esp>
305
+ <marca>DIVERSOS 2</marca>
306
+ <nVol>2</nVol>
307
+ <pesoL>2000.000</pesoL>
308
+ <pesoB>2200.000</pesoB>
309
+ </vol>
310
+ <vol>
311
+ <qVol>3</qVol>
312
+ <esp>VOLUMES 3</esp>
313
+ <marca>DIVERSOS 3</marca>
314
+ <nVol>3</nVol>
315
+ <pesoL>3000.000</pesoL>
316
+ <pesoB>3300.000</pesoB>
317
+ </vol>
318
+ </transp>
319
+ <total>
320
+ <ICMSTot>
321
+ <vFCPUFDest>0.00</vFCPUFDest>
322
+ <vICMSUFDest>0.00</vICMSUFDest>
323
+ <vICMSUFRemet>0.00</vICMSUFRemet>
324
+ </ICMSTot>
325
+ </total>
326
+ </infNFe>
327
+ </NFe>
328
+ XML
329
329
  end
330
330
  let(:volumes_number) { 2 }
331
331
 
332
332
  it 'renders title with box, subtitle, fisco box and extra volumes on the ' \
333
- 'pdf' do
333
+ 'pdf' do
334
334
  expect(File.exist?(output_pdf)).to be_falsey
335
335
 
336
336
  pdf.render_file output_pdf
@@ -341,7 +341,7 @@ describe BrDanfe::DanfeLib::NfeLib::Infadic do
341
341
 
342
342
  context 'when has address shipment' do
343
343
  let(:xml_as_string) do
344
- <<-EOS
344
+ <<~XML
345
345
  <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
346
346
  <infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
347
347
  <entrega>
@@ -357,96 +357,96 @@ describe BrDanfe::DanfeLib::NfeLib::Infadic do
357
357
  </entrega>
358
358
  </infNFe>
359
359
  </NFe>
360
- EOS
360
+ XML
361
361
  end
362
362
 
363
363
  it 'renders title with box, subtitle, fisco box and address shipment information on the pdf' do
364
- expect(File.exist?(output_pdf)).to be_falsey
364
+ expect(File.exist?(output_pdf)).to be_falsey
365
365
 
366
- pdf.render_file output_pdf
366
+ pdf.render_file output_pdf
367
367
 
368
- expect("#{base_dir}infadic#address-shipment.pdf").to have_same_content_of file: output_pdf
368
+ expect("#{base_dir}infadic#address-shipment.pdf").to have_same_content_of file: output_pdf
369
369
  end
370
370
  end
371
371
 
372
372
  context 'when has all the informations' do
373
373
  let(:xml_as_string) do
374
- <<-EOS
375
- <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
376
- <infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
377
- <dest>
378
- <CNPJ>82743287000880</CNPJ>
379
- <xNome>Schneider Electric Brasil Ltda</xNome>
380
- <enderDest>
381
- <xLgr>Av da Saudade</xLgr>
382
- <nro>1125</nro>
383
- <xBairro>Frutal</xBairro>
384
- <xCpl>Em anexo ao super mercado maior do bairro</xCpl>
385
- <cMun>3552403</cMun>
386
- <xMun>SUMARE</xMun>
387
- <UF>SP</UF>
388
- <CEP>13171320</CEP>
389
- <cPais>1058</cPais>
390
- <xPais>BRASIL</xPais>
391
- <fone>1921046300</fone>
392
- </enderDest>
393
- <IE>671008375110</IE>
394
- </dest>
395
- <transp>
396
- <vol>
397
- <qVol>1</qVol>
398
- <esp>VOLUMES 1</esp>
399
- <marca>DIVERSOS 1</marca>
400
- <nVol>1</nVol>
401
- <pesoL>1000.000</pesoL>
402
- <pesoB>1100.000</pesoB>
403
- </vol>
404
- <vol>
405
- <qVol>2</qVol>
406
- <esp>VOLUMES 2</esp>
407
- <marca>DIVERSOS 2</marca>
408
- <nVol>2</nVol>
409
- <pesoL>2000.000</pesoL>
410
- <pesoB>2200.000</pesoB>
411
- </vol>
412
- <vol>
413
- <qVol>3</qVol>
414
- <esp>VOLUMES 3</esp>
415
- <marca>DIVERSOS 3</marca>
416
- <nVol>3</nVol>
417
- <pesoL>3000.000</pesoL>
418
- <pesoB>3300.000</pesoB>
419
- </vol>
420
- </transp>
421
- <entrega>
422
- <CNPJ>32301321907894</CNPJ>
423
- <CPF></CPF>
424
- <xLgr>Rua dos bobos</xLgr>
425
- <nro>0</nro>
426
- <xCpl>Na casa não tem parede</xCpl>
427
- <xBairro>Centro</xBairro>
428
- <cMun>4218004</cMun>
429
- <xMun>TIJUCAS</xMun>
430
- <UF>SC</UF>
431
- </entrega>
432
- <infAdic>
433
- <infCpl>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec congue in dolor sed sagittis.</infCpl>
434
- <infAdFisco>Total de FCP-ST: 348,96</infAdFisco>
435
- </infAdic>
436
- <ICMSTot>
437
- <vFCPST>348.96</vFCPST>
438
- <vFCPUFDest>4892.78</vFCPUFDest>
439
- <vICMSUFDest>2915.78</vICMSUFDest>
440
- <vICMSUFRemet>75394.78</vICMSUFRemet>
441
- </ICMSTot>
442
- </infNFe>
443
- </NFe>
444
- EOS
374
+ <<~XML
375
+ <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
376
+ <infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
377
+ <dest>
378
+ <CNPJ>82743287000880</CNPJ>
379
+ <xNome>Schneider Electric Brasil Ltda</xNome>
380
+ <enderDest>
381
+ <xLgr>Av da Saudade</xLgr>
382
+ <nro>1125</nro>
383
+ <xBairro>Frutal</xBairro>
384
+ <xCpl>Em anexo ao super mercado maior do bairro</xCpl>
385
+ <cMun>3552403</cMun>
386
+ <xMun>SUMARE</xMun>
387
+ <UF>SP</UF>
388
+ <CEP>13171320</CEP>
389
+ <cPais>1058</cPais>
390
+ <xPais>BRASIL</xPais>
391
+ <fone>1921046300</fone>
392
+ </enderDest>
393
+ <IE>671008375110</IE>
394
+ </dest>
395
+ <transp>
396
+ <vol>
397
+ <qVol>1</qVol>
398
+ <esp>VOLUMES 1</esp>
399
+ <marca>DIVERSOS 1</marca>
400
+ <nVol>1</nVol>
401
+ <pesoL>1000.000</pesoL>
402
+ <pesoB>1100.000</pesoB>
403
+ </vol>
404
+ <vol>
405
+ <qVol>2</qVol>
406
+ <esp>VOLUMES 2</esp>
407
+ <marca>DIVERSOS 2</marca>
408
+ <nVol>2</nVol>
409
+ <pesoL>2000.000</pesoL>
410
+ <pesoB>2200.000</pesoB>
411
+ </vol>
412
+ <vol>
413
+ <qVol>3</qVol>
414
+ <esp>VOLUMES 3</esp>
415
+ <marca>DIVERSOS 3</marca>
416
+ <nVol>3</nVol>
417
+ <pesoL>3000.000</pesoL>
418
+ <pesoB>3300.000</pesoB>
419
+ </vol>
420
+ </transp>
421
+ <entrega>
422
+ <CNPJ>32301321907894</CNPJ>
423
+ <CPF></CPF>
424
+ <xLgr>Rua dos bobos</xLgr>
425
+ <nro>0</nro>
426
+ <xCpl>Na casa não tem parede</xCpl>
427
+ <xBairro>Centro</xBairro>
428
+ <cMun>4218004</cMun>
429
+ <xMun>TIJUCAS</xMun>
430
+ <UF>SC</UF>
431
+ </entrega>
432
+ <infAdic>
433
+ <infCpl>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec congue in dolor sed sagittis.</infCpl>
434
+ <infAdFisco>Total de FCP-ST: 348,96</infAdFisco>
435
+ </infAdic>
436
+ <ICMSTot>
437
+ <vFCPST>348.96</vFCPST>
438
+ <vFCPUFDest>4892.78</vFCPUFDest>
439
+ <vICMSUFDest>2915.78</vICMSUFDest>
440
+ <vICMSUFRemet>75394.78</vICMSUFRemet>
441
+ </ICMSTot>
442
+ </infNFe>
443
+ </NFe>
444
+ XML
445
445
  end
446
446
  let(:volumes_number) { 3 }
447
447
 
448
448
  it 'renders title with box, subtitle, fisco box, extra volumes, ' \
449
- 'complementary information, address and difal on the pdf' do
449
+ 'complementary information, address and difal on the pdf' do
450
450
  expect(File.exist?(output_pdf)).to be_falsey
451
451
 
452
452
  pdf.render_file output_pdf
@@ -5,11 +5,12 @@ describe BrDanfe::DanfeLib::NfeLib::InfadicVol do
5
5
  let(:output_pdf) { "#{base_dir}output.pdf" }
6
6
  let(:pdf) { BrDanfe::DanfeLib::NfeLib::Document.new }
7
7
  let(:xml) { BrDanfe::XML.new(xml_as_string) }
8
+
8
9
  subject { described_class.new(xml, pdf) }
9
10
 
10
11
  describe '#render' do
11
12
  let(:xml_as_string) do
12
- <<-EOS
13
+ <<~XML
13
14
  <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
14
15
  <infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
15
16
  <dest>
@@ -74,7 +75,7 @@ describe BrDanfe::DanfeLib::NfeLib::InfadicVol do
74
75
  </ICMSTot>
75
76
  </infNFe>
76
77
  </NFe>
77
- EOS
78
+ XML
78
79
  end
79
80
 
80
81
  before do
@@ -11,28 +11,28 @@ describe BrDanfe::DanfeLib::NfeLib::Issqn do
11
11
 
12
12
  describe '#render' do
13
13
  let(:xml_as_string) do
14
- <<-eos
15
- <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
16
- <infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
17
- <emit>
18
- <IM>2345</IM>
19
- </emit>
20
- <total>
21
- <ISSQNtot>
22
- #{issqn}
23
- </ISSQNtot>
24
- </total>
25
- </infNFe>
26
- </NFe>
27
- eos
14
+ <<~XML
15
+ <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
16
+ <infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
17
+ <emit>
18
+ <IM>2345</IM>
19
+ </emit>
20
+ <total>
21
+ <ISSQNtot>
22
+ #{issqn}
23
+ </ISSQNtot>
24
+ </total>
25
+ </infNFe>
26
+ </NFe>
27
+ XML
28
28
  end
29
29
 
30
30
  let(:issqn) do
31
- <<-eos
31
+ <<~XML
32
32
  <vServ>1.43</vServ>
33
33
  <vBC>2.34</vBC>
34
34
  <vISS>3.45</vISS>
35
- eos
35
+ XML
36
36
  end
37
37
 
38
38
  before do