br_danfe 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -1
  3. data/br_danfe.gemspec +3 -1
  4. data/circle.yml +5 -0
  5. data/config/locales/pt-BR.yml +4 -3
  6. data/lib/br_danfe/danfe.rb +2 -2
  7. data/lib/br_danfe/dest.rb +12 -22
  8. data/lib/br_danfe/det_header.rb +1 -2
  9. data/lib/br_danfe/document.rb +34 -9
  10. data/lib/br_danfe/emit.rb +8 -18
  11. data/lib/br_danfe/issqn.rb +3 -3
  12. data/lib/br_danfe/ticket.rb +10 -5
  13. data/lib/br_danfe/transp.rb +17 -4
  14. data/lib/br_danfe/version.rb +1 -1
  15. data/lib/br_danfe/xprod.rb +4 -4
  16. data/lib/br_danfe.rb +1 -0
  17. data/spec/features/br_danfe_spec.rb +2 -19
  18. data/spec/fixtures/lib/dest#render-with_cnpj.pdf +201 -0
  19. data/spec/fixtures/lib/dest#render-with_cpf.pdf +201 -0
  20. data/spec/fixtures/lib/dest#render-with_ie.pdf +208 -0
  21. data/spec/fixtures/lib/det_body#render-csosn.pdf +855 -0
  22. data/spec/fixtures/lib/det_body#render-cst.pdf +512 -0
  23. data/spec/fixtures/lib/det_body#render-fci.pdf +260 -0
  24. data/spec/fixtures/lib/det_body#render-icms_st.pdf +267 -0
  25. data/spec/fixtures/lib/det_header#render.pdf +207 -0
  26. data/spec/fixtures/lib/document#lcnpj-blank.pdf +74 -0
  27. data/spec/fixtures/lib/document#lcnpj-invalid.pdf +74 -0
  28. data/spec/fixtures/lib/document#lcnpj-valid.pdf +81 -0
  29. data/spec/fixtures/lib/document#lie-blank.pdf +74 -0
  30. data/spec/fixtures/lib/document#lie-invalid.pdf +74 -0
  31. data/spec/fixtures/lib/document#lie-valid.pdf +81 -0
  32. data/spec/fixtures/lib/dup#render.pdf +216 -0
  33. data/spec/fixtures/lib/emit#render.pdf +143 -0
  34. data/spec/fixtures/lib/emit_header#render-with_logo.pdf +712 -0
  35. data/spec/fixtures/lib/emit_header#render-without_logo.pdf +650 -0
  36. data/spec/fixtures/lib/icmstot#render.pdf +255 -0
  37. data/spec/fixtures/lib/infadic#render-extra_volume.pdf +295 -0
  38. data/spec/fixtures/lib/infadic#render.pdf +104 -0
  39. data/spec/fixtures/lib/issqn#render.pdf +143 -0
  40. data/spec/fixtures/lib/ticket#render.pdf +113 -0
  41. data/spec/fixtures/lib/transp#render.pdf +239 -0
  42. data/spec/fixtures/lib/vol#render.pdf +152 -0
  43. data/spec/fixtures/{v2.00/nfe_with_logo.xml.logo.png → logo.png} +0 -0
  44. data/spec/fixtures/v2.00/nfe_simples_nacional.xml.fixture.pdf +14 -14
  45. data/spec/fixtures/v2.00/nfe_with_extra_volumes.xml.fixture.pdf +29 -43
  46. data/spec/fixtures/v2.00/nfe_with_fci.xml.fixture.pdf +12 -12
  47. data/spec/fixtures/v2.00/nfe_with_logo.xml.fixture.pdf +16 -16
  48. data/spec/fixtures/v2.00/nfe_with_ns.xml.fixture.pdf +29 -43
  49. data/spec/fixtures/v2.00/nfe_without_ns.xml.fixture.pdf +13 -27
  50. data/spec/fixtures/v3.10/nfe_simples_nacional.xml.fixture.pdf +23 -23
  51. data/spec/lib/dest_spec.rb +69 -0
  52. data/spec/lib/det_body_spec.rb +299 -0
  53. data/spec/lib/det_header_spec.rb +26 -0
  54. data/spec/lib/document_spec.rb +172 -0
  55. data/spec/lib/dup_spec.rb +52 -0
  56. data/spec/lib/emit_header_spec.rb +76 -0
  57. data/spec/lib/emit_spec.rb +54 -0
  58. data/spec/lib/icmstot_spec.rb +48 -0
  59. data/spec/lib/infadic_spec.rb +81 -0
  60. data/spec/lib/issqn_spec.rb +45 -0
  61. data/spec/lib/ticket_spec.rb +42 -0
  62. data/spec/lib/transp_spec.rb +51 -0
  63. data/spec/lib/vol_spec.rb +65 -0
  64. data/spec/lib/xprod_spec.rb +2 -2
  65. metadata +96 -12
  66. data/spec/fixtures/v2.00/nfe_with_cpf.xml +0 -1
  67. data/spec/fixtures/v2.00/nfe_with_cpf.xml.fixture.pdf +0 -1871
@@ -17,7 +17,7 @@ endobj
17
17
  >>
18
18
  endobj
19
19
  4 0 obj
20
- << /Length 18845
20
+ << /Length 18821
21
21
  >>
22
22
  stream
23
23
  q
@@ -92,7 +92,7 @@ S
92
92
  0.000 0.000 0.000 SCN
93
93
 
94
94
  BT
95
- 264.20472440944883 327.09118897637796 Td
95
+ 264.2047244094488 327.09118897637796 Td
96
96
  /F1.0 6 Tf
97
97
  [<35313031>] TJ
98
98
  ET
@@ -274,7 +274,7 @@ S
274
274
  0.000 0.000 0.000 SCN
275
275
 
276
276
  BT
277
- 264.20472440944883 316.39518897637794 Td
277
+ 264.2047244094488 316.39518897637794 Td
278
278
  /F1.0 6 Tf
279
279
  [<35313031>] TJ
280
280
  ET
@@ -424,14 +424,14 @@ ET
424
424
  BT
425
425
  65.77952755905513 299.003188976378 Td
426
426
  /F1.0 6 Tf
427
- [<5354> 50 <3a204d56> 135 <413a2032342e3030303025202a20416ced713a2031372e3030303025202a2042433a20372e3636202a>] TJ
427
+ [<5354> 50 <3a204d56> 135 <413a2032342c303025202a20416ced713a2031372c303025202a2042433a20372c3636202a20566c723a>] TJ
428
428
  ET
429
429
 
430
430
 
431
431
  BT
432
432
  65.77952755905513 292.307188976378 Td
433
433
  /F1.0 6 Tf
434
- [<566c723a20302e3235>] TJ
434
+ [<302c3235>] TJ
435
435
  ET
436
436
 
437
437
  [0.3 0.6] 0 d
@@ -470,7 +470,7 @@ S
470
470
  0.000 0.000 0.000 SCN
471
471
 
472
472
  BT
473
- 264.20472440944883 305.69918897637797 Td
473
+ 264.2047244094488 305.69918897637797 Td
474
474
  /F1.0 6 Tf
475
475
  [<35343031>] TJ
476
476
  ET
@@ -620,14 +620,14 @@ ET
620
620
  BT
621
621
  65.77952755905513 274.915188976378 Td
622
622
  /F1.0 6 Tf
623
- [<5354> 50 <3a204d56> 135 <413a2032342e3030303025202a20416ced713a2031372e3030303025202a2042433a2031302e3332202a>] TJ
623
+ [<5354> 50 <3a204d56> 135 <413a2032342c303025202a20416ced713a2031372c303025202a2042433a2031302c3332202a20566c723a>] TJ
624
624
  ET
625
625
 
626
626
 
627
627
  BT
628
628
  65.77952755905513 268.21918897637795 Td
629
629
  /F1.0 6 Tf
630
- [<566c723a20302e3334>] TJ
630
+ [<302c3334>] TJ
631
631
  ET
632
632
 
633
633
  [0.3 0.6] 0 d
@@ -666,7 +666,7 @@ S
666
666
  0.000 0.000 0.000 SCN
667
667
 
668
668
  BT
669
- 264.20472440944883 281.61118897637795 Td
669
+ 264.2047244094488 281.61118897637795 Td
670
670
  /F1.0 6 Tf
671
671
  [<35343031>] TJ
672
672
  ET
@@ -848,7 +848,7 @@ S
848
848
  0.000 0.000 0.000 SCN
849
849
 
850
850
  BT
851
- 264.20472440944883 257.523188976378 Td
851
+ 264.2047244094488 257.523188976378 Td
852
852
  /F1.0 6 Tf
853
853
  [<35313031>] TJ
854
854
  ET
@@ -1030,7 +1030,7 @@ S
1030
1030
  0.000 0.000 0.000 SCN
1031
1031
 
1032
1032
  BT
1033
- 264.20472440944883 246.82718897637793 Td
1033
+ 264.2047244094488 246.82718897637793 Td
1034
1034
  /F1.0 6 Tf
1035
1035
  [<35313031>] TJ
1036
1036
  ET
@@ -1212,7 +1212,7 @@ S
1212
1212
  0.000 0.000 0.000 SCN
1213
1213
 
1214
1214
  BT
1215
- 264.20472440944883 236.13118897637793 Td
1215
+ 264.2047244094488 236.13118897637793 Td
1216
1216
  /F1.0 6 Tf
1217
1217
  [<35343035>] TJ
1218
1218
  ET
@@ -1394,7 +1394,7 @@ S
1394
1394
  0.000 0.000 0.000 SCN
1395
1395
 
1396
1396
  BT
1397
- 264.20472440944883 225.43518897637793 Td
1397
+ 264.2047244094488 225.43518897637793 Td
1398
1398
  /F1.0 6 Tf
1399
1399
  [<35323031>] TJ
1400
1400
  ET
@@ -1547,12 +1547,12 @@ endobj
1547
1547
  /MediaBox [0 0 595.28 841.89]
1548
1548
  /Contents 4 0 R
1549
1549
  /Resources << /ProcSet [/PDF /Text /ImageB /ImageC /ImageI]
1550
- /Font << /F1.0 7 0 R
1551
- /F2.0 9 0 R
1552
- >>
1553
1550
  /XObject << /Stamp1 6 0 R
1554
1551
  /Stamp2 8 0 R
1555
1552
  >>
1553
+ /Font << /F1.0 7 0 R
1554
+ /F2.0 9 0 R
1555
+ >>
1556
1556
  >>
1557
1557
  >>
1558
1558
  endobj
@@ -2716,17 +2716,17 @@ xref
2716
2716
  0000000109 00000 n
2717
2717
  0000000158 00000 n
2718
2718
  0000000215 00000 n
2719
- 0000019113 00000 n
2720
- 0000019348 00000 n
2721
- 0000019866 00000 n
2722
- 0000019965 00000 n
2723
- 0000036799 00000 n
2724
- 0000036897 00000 n
2719
+ 0000019089 00000 n
2720
+ 0000019324 00000 n
2721
+ 0000019842 00000 n
2722
+ 0000019941 00000 n
2723
+ 0000036775 00000 n
2724
+ 0000036873 00000 n
2725
2725
  trailer
2726
2726
  << /Size 11
2727
2727
  /Root 2 0 R
2728
2728
  /Info 1 0 R
2729
2729
  >>
2730
2730
  startxref
2731
- 36998
2731
+ 36974
2732
2732
  %%EOF
@@ -95,5 +95,74 @@ describe BrDanfe::Dest do
95
95
  expect("#{base_dir}dest#render-v3.10.pdf").to be_same_file_as(output_pdf)
96
96
  end
97
97
  end
98
+
99
+ context "when recipient has CNPJ" do
100
+ let(:xml_as_string) do
101
+ <<-eos
102
+ <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
103
+ <infNFe Id="NFe25111012345678901234550020000134151000134151" versao="3.10">
104
+ <dest>
105
+ <CNPJ>71058884000183</CNPJ>
106
+ </dest>
107
+ </infNFe>
108
+ </NFe>
109
+ eos
110
+ end
111
+
112
+ it "renders xml to the pdf" do
113
+ expect(File.exist?(output_pdf)).to be_falsey
114
+
115
+ pdf.render_file output_pdf
116
+
117
+ expect("#{base_dir}dest#render-with_cnpj.pdf").to be_same_file_as(output_pdf)
118
+ end
119
+ end
120
+
121
+ context "when recipient has CPF" do
122
+ let(:xml_as_string) do
123
+ <<-eos
124
+ <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
125
+ <infNFe Id="NFe25111012345678901234550020000134151000134151" versao="3.10">
126
+ <dest>
127
+ <CPF>48532557457</CPF>
128
+ </dest>
129
+ </infNFe>
130
+ </NFe>
131
+ eos
132
+ end
133
+
134
+ it "renders xml to the pdf" do
135
+ expect(File.exist?(output_pdf)).to be_falsey
136
+
137
+ pdf.render_file output_pdf
138
+
139
+ expect("#{base_dir}dest#render-with_cpf.pdf").to be_same_file_as(output_pdf)
140
+ end
141
+ end
142
+
143
+ context "when recipient has IE" do
144
+ let(:xml_as_string) do
145
+ <<-eos
146
+ <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
147
+ <infNFe Id="NFe25111012345678901234550020000134151000134151" versao="3.10">
148
+ <dest>
149
+ <enderDest>
150
+ <UF>SP</UF>
151
+ </enderDest>
152
+ <IE>671008375110</IE>
153
+ </dest>
154
+ </infNFe>
155
+ </NFe>
156
+ eos
157
+ end
158
+
159
+ it "renders xml to the pdf" do
160
+ expect(File.exist?(output_pdf)).to be_falsey
161
+
162
+ pdf.render_file output_pdf
163
+
164
+ expect("#{base_dir}dest#render-with_ie.pdf").to be_same_file_as(output_pdf)
165
+ end
166
+ end
98
167
  end
99
168
  end
@@ -0,0 +1,299 @@
1
+ require "spec_helper"
2
+
3
+ describe BrDanfe::DetBody do
4
+ let(:base_dir) { "./spec/fixtures/lib/"}
5
+ let(:output_pdf) { "#{base_dir}output.pdf" }
6
+
7
+ let(:pdf) { BrDanfe::Document.new }
8
+ let(:xml) { BrDanfe::XML.new(xml_as_string) }
9
+
10
+ subject { described_class.new(pdf, xml) }
11
+
12
+ describe "#render" do
13
+ before do
14
+ subject.render
15
+ File.delete(output_pdf) if File.exist?(output_pdf)
16
+ end
17
+
18
+ context "with CSOSN" do
19
+ let(:xml_as_string) do
20
+ <<-eos
21
+ <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
22
+ <infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
23
+ <det nItem="1">
24
+ <prod>
25
+ <cProd>1</cProd>
26
+ <xProd>Produto com CSOSN 101 - Nacional</xProd>
27
+ <NCM>12345678</NCM>
28
+ <CFOP>5101</CFOP>
29
+ <uCom>UN</uCom>
30
+ <qCom>2.0000</qCom>
31
+ <vUnCom>1.0100000000</vUnCom>
32
+ <vProd>2.02</vProd>
33
+ </prod>
34
+ <imposto>
35
+ <ICMS>
36
+ <ICMSSN101>
37
+ <orig>0</orig>
38
+ <CSOSN>101</CSOSN>
39
+ </ICMSSN101>
40
+ </ICMS>
41
+ </imposto>
42
+ </det>
43
+ <det nItem="2">
44
+ <prod>
45
+ <cProd>2</cProd>
46
+ <xProd>Produto com CSOSN 102 - Estrangeiro</xProd>
47
+ <NCM>23456789</NCM>
48
+ <CFOP>5101</CFOP>
49
+ <uCom>UN</uCom>
50
+ <qCom>4.0000</qCom>
51
+ <vUnCom>1.0200000000</vUnCom>
52
+ <vProd>4.08</vProd>
53
+ </prod>
54
+ <imposto>
55
+ <ICMS>
56
+ <ICMSSN102>
57
+ <orig>1</orig>
58
+ <CSOSN>102</CSOSN>
59
+ </ICMSSN102>
60
+ </ICMS>
61
+ </imposto>
62
+ </det>
63
+ <det nItem="3">
64
+ <prod>
65
+ <cProd>3</cProd>
66
+ <xProd>Produto Com Csosn 201</xProd>
67
+ <NCM>45678901</NCM>
68
+ <CFOP>5401</CFOP>
69
+ <uCom>UN</uCom>
70
+ <qCom>6.0000</qCom>
71
+ <vUnCom>1.0300000000</vUnCom>
72
+ <vProd>6.18</vProd>
73
+ </prod>
74
+ <imposto>
75
+ <ICMS>
76
+ <ICMSSN201>
77
+ <orig>0</orig>
78
+ <CSOSN>201</CSOSN>
79
+ <pMVAST>24.0000</pMVAST>
80
+ <vBCST>7.66</vBCST>
81
+ <pICMSST>17.0000</pICMSST>
82
+ <vICMSST>0.25</vICMSST>
83
+ </ICMSSN201>
84
+ </ICMS>
85
+ </imposto>
86
+ </det>
87
+ <det nItem="4">
88
+ <prod>
89
+ <cProd>8</cProd>
90
+ <xProd>Produto com CSOSN 900 - Com ICMS</xProd>
91
+ <NCM>34567890</NCM>
92
+ <CFOP>5201</CFOP>
93
+ <uCom>UN</uCom>
94
+ <qCom>16.0000</qCom>
95
+ <vUnCom>1.0800000000</vUnCom>
96
+ <vProd>17.28</vProd>
97
+ </prod>
98
+ <imposto>
99
+ <ICMS>
100
+ <ICMSSN900>
101
+ <orig>0</orig>
102
+ <CSOSN>900</CSOSN>
103
+ <vBC>9.87</vBC>
104
+ <pICMS>8.76</pICMS>
105
+ <vICMS>7.65</vICMS>
106
+ </ICMSSN900>
107
+ </ICMS>
108
+ </imposto>
109
+ </det>
110
+ </infNFe>
111
+ </NFe>
112
+ eos
113
+ end
114
+
115
+ it "renders xml to the pdf" do
116
+ expect(File.exist?(output_pdf)).to be_falsey
117
+
118
+ pdf.render_file output_pdf
119
+
120
+ expect("#{base_dir}det_body#render-csosn.pdf").to be_same_file_as(output_pdf)
121
+ end
122
+ end
123
+
124
+ context "with CST" do
125
+ let(:xml_as_string) do
126
+ <<-eos
127
+ <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
128
+ <infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
129
+ <det nItem="1">
130
+ <prod>
131
+ <cProd>REF 04</cProd>
132
+ <xProd>Produto com CST 00 - Nacional - ICMS - IPI</xProd>
133
+ <NCM>90303329</NCM>
134
+ <EXTIPI>00</EXTIPI>
135
+ <CFOP>5101</CFOP>
136
+ <uCom>PC</uCom>
137
+ <qCom>1.00</qCom>
138
+ <vUnCom>49.23</vUnCom>
139
+ <vProd>49.23</vProd>
140
+ <xPed>98001921</xPed>
141
+ <nItemPed>10</nItemPed>
142
+ </prod>
143
+ <imposto>
144
+ <ICMS>
145
+ <ICMS00>
146
+ <orig>0</orig>
147
+ <CST>00</CST>
148
+ <modBC>3</modBC>
149
+ <vBC>49.23</vBC>
150
+ <pICMS>12.00</pICMS>
151
+ <vICMS>5.90</vICMS>
152
+ </ICMS00>
153
+ </ICMS>
154
+ <IPI>
155
+ <cEnq>999</cEnq>
156
+ <IPITrib>
157
+ <CST>50</CST>
158
+ <vBC>49.23</vBC>
159
+ <pIPI>5.00</pIPI>
160
+ <vIPI>2.46</vIPI>
161
+ </IPITrib>
162
+ </IPI>
163
+ </imposto>
164
+ </det>
165
+ <det nItem="2">
166
+ <prod>
167
+ <cProd>REF 05</cProd>
168
+ <xProd>Produto com CST 00 - Estrangeiro - ICMS - IPI</xProd>
169
+ <NCM>90303329</NCM>
170
+ <EXTIPI>00</EXTIPI>
171
+ <CFOP>5101</CFOP>
172
+ <uCom>PC</uCom>
173
+ <qCom>1.00</qCom>
174
+ <vUnCom>49.23</vUnCom>
175
+ <vProd>49.23</vProd>
176
+ <xPed>98001921</xPed>
177
+ <nItemPed>10</nItemPed>
178
+ </prod>
179
+ <imposto>
180
+ <ICMS>
181
+ <ICMS00>
182
+ <orig>1</orig>
183
+ <CST>00</CST>
184
+ <modBC>3</modBC>
185
+ <vBC>49.23</vBC>
186
+ <pICMS>12.00</pICMS>
187
+ <vICMS>5.90</vICMS>
188
+ </ICMS00>
189
+ </ICMS>
190
+ <IPI>
191
+ <cEnq>999</cEnq>
192
+ <IPITrib>
193
+ <CST>50</CST>
194
+ <vBC>49.23</vBC>
195
+ <pIPI>5.00</pIPI>
196
+ <vIPI>2.46</vIPI>
197
+ </IPITrib>
198
+ </IPI>
199
+ </imposto>
200
+ </det>
201
+ </infNFe>
202
+ </NFe>
203
+ eos
204
+ end
205
+
206
+ it "renders xml to the pdf" do
207
+ expect(File.exist?(output_pdf)).to be_falsey
208
+
209
+ pdf.render_file output_pdf
210
+
211
+ expect("#{base_dir}det_body#render-cst.pdf").to be_same_file_as(output_pdf)
212
+ end
213
+ end
214
+
215
+ context "with FCI" do
216
+ let(:xml_as_string) do
217
+ <<-eos
218
+ <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
219
+ <infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
220
+ <det nItem="1">
221
+ <prod>
222
+ <cProd>REF 06</cProd>
223
+ <xProd>Produto com FCI</xProd>
224
+ <NCM>90303329</NCM>
225
+ <EXTIPI>00</EXTIPI>
226
+ <CFOP>5101</CFOP>
227
+ <uCom>PC</uCom>
228
+ <qCom>1.00</qCom>
229
+ <vUnCom>49.23</vUnCom>
230
+ <vProd>49.23</vProd>
231
+ <nFCI>12232531-74B2-4FDD-87A6-CF0AD3E55386</nFCI>
232
+ </prod>
233
+ <imposto>
234
+ <ICMS>
235
+ <ICMS00>
236
+ <orig>0</orig>
237
+ <CST>00</CST>
238
+ </ICMS00>
239
+ </ICMS>
240
+ </imposto>
241
+ </det>
242
+ </infNFe>
243
+ </NFe>
244
+ eos
245
+ end
246
+
247
+ it "renders xml to the pdf" do
248
+ expect(File.exist?(output_pdf)).to be_falsey
249
+
250
+ pdf.render_file output_pdf
251
+
252
+ expect("#{base_dir}det_body#render-fci.pdf").to be_same_file_as(output_pdf)
253
+ end
254
+ end
255
+
256
+ context "with ICMS ST" do
257
+ let(:xml_as_string) do
258
+ <<-eos
259
+ <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
260
+ <infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
261
+ <det nItem="1">
262
+ <prod>
263
+ <cProd>3</cProd>
264
+ <xProd>Produto Com Csosn 201 - ICMS ST</xProd>
265
+ <NCM>45678901</NCM>
266
+ <CFOP>5401</CFOP>
267
+ <uCom>UN</uCom>
268
+ <qCom>6.0000</qCom>
269
+ <vUnCom>1.0300000000</vUnCom>
270
+ <vProd>6.18</vProd>
271
+ </prod>
272
+ <imposto>
273
+ <ICMS>
274
+ <ICMSSN201>
275
+ <orig>0</orig>
276
+ <CSOSN>201</CSOSN>
277
+ <pMVAST>24.0000</pMVAST>
278
+ <vBCST>7.66</vBCST>
279
+ <pICMSST>17.0000</pICMSST>
280
+ <vICMSST>0.25</vICMSST>
281
+ </ICMSSN201>
282
+ </ICMS>
283
+ </imposto>
284
+ </det>
285
+ </infNFe>
286
+ </NFe>
287
+ eos
288
+ end
289
+
290
+ it "renders xml to the pdf" do
291
+ expect(File.exist?(output_pdf)).to be_falsey
292
+
293
+ pdf.render_file output_pdf
294
+
295
+ expect("#{base_dir}det_body#render-icms_st.pdf").to be_same_file_as(output_pdf)
296
+ end
297
+ end
298
+ end
299
+ end
@@ -0,0 +1,26 @@
1
+ require "spec_helper"
2
+
3
+ describe BrDanfe::DetHeader do
4
+ let(:base_dir) { "./spec/fixtures/lib/"}
5
+ let(:output_pdf) { "#{base_dir}output.pdf" }
6
+
7
+ let(:pdf) { BrDanfe::Document.new }
8
+ let(:xml) { BrDanfe::XML.new(xml_as_string) }
9
+
10
+ subject { described_class.new(pdf) }
11
+
12
+ describe "#render" do
13
+ before do
14
+ subject.render
15
+ File.delete(output_pdf) if File.exist?(output_pdf)
16
+ end
17
+
18
+ it "renders xml to the pdf" do
19
+ expect(File.exist?(output_pdf)).to be_falsey
20
+
21
+ pdf.render_file output_pdf
22
+
23
+ expect("#{base_dir}det_header#render.pdf").to be_same_file_as(output_pdf)
24
+ end
25
+ end
26
+ end