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.
- checksums.yaml +4 -4
- data/.github/workflows/config.yml +5 -7
- data/Gemfile +15 -0
- data/Gemfile.lock +45 -27
- data/br_danfe.gemspec +1 -12
- data/config/locales/pt-BR.yml +4 -3
- data/lib/br_danfe/cce_lib/document.rb +2 -2
- data/lib/br_danfe/danfe_lib/nfce_lib/document.rb +2 -2
- data/lib/br_danfe/danfe_lib/nfce_lib/header.rb +1 -1
- data/lib/br_danfe/danfe_lib/nfe_lib/dest.rb +2 -10
- data/lib/br_danfe/danfe_lib/nfe_lib/document.rb +9 -9
- data/lib/br_danfe/danfe_lib/nfe_lib/emit_header.rb +9 -1
- data/lib/br_danfe/danfe_lib/nfe_lib/entrega.rb +2 -10
- data/lib/br_danfe/danfe_lib/nfe_lib/infadic.rb +1 -1
- data/lib/br_danfe/danfe_lib/nfe_lib/transp.rb +1 -1
- data/lib/br_danfe/document_builder.rb +2 -2
- data/lib/br_danfe/logo_options.rb +1 -1
- data/lib/br_danfe/mdfe_lib/document.rb +2 -2
- data/lib/br_danfe/version.rb +1 -1
- data/lib/br_danfe.rb +1 -1
- data/lib/prawn/font.rb +1 -1
- data/spec/br_danfe/cce_lib/barcode_spec.rb +1 -1
- data/spec/br_danfe/cce_lib/correction_spec.rb +1 -1
- data/spec/br_danfe/cce_lib/document_spec.rb +7 -7
- data/spec/br_danfe/cce_lib/footer_spec.rb +1 -1
- data/spec/br_danfe/cce_lib/header_spec.rb +1 -1
- data/spec/br_danfe/cce_lib/nfe_key_spec.rb +1 -1
- data/spec/br_danfe/cce_lib/protocol_spec.rb +1 -1
- data/spec/br_danfe/cce_spec.rb +2 -2
- data/spec/br_danfe/danfe_lib/nfce_lib/document_spec.rb +1 -1
- data/spec/br_danfe/danfe_lib/nfce_lib/footer_spec.rb +1 -1
- data/spec/br_danfe/danfe_lib/nfce_lib/header_spec.rb +2 -2
- data/spec/br_danfe/danfe_lib/nfce_lib/key_spec.rb +1 -1
- data/spec/br_danfe/danfe_lib/nfce_lib/nfce_identification_spec.rb +1 -1
- data/spec/br_danfe/danfe_lib/nfce_lib/product_list_spec.rb +1 -1
- data/spec/br_danfe/danfe_lib/nfce_lib/recipient_spec.rb +1 -1
- data/spec/br_danfe/danfe_lib/nfce_lib/total_list_spec.rb +1 -1
- data/spec/br_danfe/danfe_lib/nfce_spec.rb +3 -3
- data/spec/br_danfe/danfe_lib/nfe_lib/dest_spec.rb +1 -1
- data/spec/br_danfe/danfe_lib/nfe_lib/det_body_spec.rb +8 -8
- data/spec/br_danfe/danfe_lib/nfe_lib/document_spec.rb +9 -9
- data/spec/br_danfe/danfe_lib/nfe_lib/dup_spec.rb +1 -1
- data/spec/br_danfe/danfe_lib/nfe_lib/emit_header_spec.rb +66 -3
- data/spec/br_danfe/danfe_lib/nfe_lib/entrega_spec.rb +1 -1
- data/spec/br_danfe/danfe_lib/nfe_lib/icmstot_spec.rb +1 -1
- data/spec/br_danfe/danfe_lib/nfe_lib/infadic_spec.rb +1 -1
- data/spec/br_danfe/danfe_lib/nfe_lib/infadic_vol_spec.rb +1 -1
- data/spec/br_danfe/danfe_lib/nfe_lib/issqn_spec.rb +1 -1
- data/spec/br_danfe/danfe_lib/nfe_lib/ticket_spec.rb +3 -3
- data/spec/br_danfe/danfe_lib/nfe_lib/transp_spec.rb +1 -1
- data/spec/br_danfe/danfe_lib/nfe_lib/vol_spec.rb +1 -1
- data/spec/br_danfe/danfe_lib/nfe_spec.rb +6 -6
- data/spec/br_danfe/mdfe_lib/fisco_control_spec.rb +1 -1
- data/spec/br_danfe/mdfe_lib/header_spec.rb +1 -1
- data/spec/br_danfe/mdfe_lib/notes_spec.rb +1 -1
- data/spec/br_danfe/mdfe_spec.rb +2 -2
- data/spec/br_danfe/qr_code_spec.rb +1 -1
- data/spec/fixtures/nfe/lib/emit_header#render-nfe_key.pdf +16 -16
- data/spec/fixtures/nfe/lib/emit_header#render-second_page.pdf +16 -16
- data/spec/fixtures/nfe/lib/emit_header#render-with_cpf.pdf +1075 -2
- data/spec/fixtures/nfe/lib/emit_header#render-with_logo.pdf +16 -16
- data/spec/fixtures/nfe/lib/emit_header#render-without_logo.pdf +14 -14
- data/spec/fixtures/nfe/lib/entrega#render-v2.00.pdf +0 -0
- data/spec/fixtures/nfe/lib/entrega#render-with-address-bigger.pdf +0 -0
- data/spec/fixtures/nfe/lib/entrega#render-with_cpf.pdf +0 -0
- data/spec/fixtures/nfe/v2.00/custom_options.fixture.pdf +17 -17
- data/spec/fixtures/nfe/v2.00/nfe_simples_nacional.xml.fixture.pdf +15 -15
- data/spec/fixtures/nfe/v2.00/nfe_with_entrega.xml.fixture.pdf +16 -16
- data/spec/fixtures/nfe/v2.00/nfe_with_extra_volumes.xml.fixture.pdf +24 -24
- data/spec/fixtures/nfe/v2.00/nfe_with_fci.xml.fixture.pdf +15 -15
- data/spec/fixtures/nfe/v2.00/nfe_with_ns.xml.fixture.pdf +19 -19
- data/spec/fixtures/nfe/v2.00/nfe_without_ns.xml.fixture.pdf +15 -15
- data/spec/fixtures/nfe/v3.10/multiples.xmls.on.the.same.pdf.pdf +19 -19
- data/spec/fixtures/nfe/v3.10/nfe_simples_nacional.xml.fixture.pdf +15 -15
- data/spec/fixtures/nfe/v3.10/with_footer.fixture.pdf +19 -19
- data/spec/fixtures/nfe/v3.10/with_issqn.fixture.pdf +15 -15
- data/spec/fixtures/nfe/v3.10/with_three_pages.fixture.pdf +23 -23
- data/spec/fixtures/nfe/v3.10/without_issqn.fixture.pdf +19 -19
- data/spec/spec_helper.rb +9 -1
- metadata +8 -160
- /data/spec/fixtures/nfe/lib/{document#lcnpj-blank.pdf → document#lcnpj_cpf-blank.pdf} +0 -0
- /data/spec/fixtures/nfe/lib/{document#lcnpj-invalid.pdf → document#lcnpj_cpf-invalid.pdf} +0 -0
- /data/spec/fixtures/nfe/lib/{document#lcnpj-valid.pdf → document#lcnpj_cpf-valid.pdf} +0 -0
|
@@ -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 =
|
|
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 {
|
|
25
|
-
after {
|
|
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
|
|
@@ -17,7 +17,7 @@ describe BrDanfe::DanfeLib::NfeLib::DetBody do
|
|
|
17
17
|
XML
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
-
let(:
|
|
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(:
|
|
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
|
-
|
|
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) { "#{
|
|
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) { "#{
|
|
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) {
|
|
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) { ("#{
|
|
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) { ("#{
|
|
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
|
-
|
|
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 '#
|
|
117
|
+
describe '#lcnpj_cpf' do
|
|
118
118
|
before do
|
|
119
119
|
subject.render
|
|
120
|
-
|
|
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.
|
|
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#
|
|
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.
|
|
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#
|
|
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.
|
|
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#
|
|
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
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
@@ -38,7 +38,7 @@ describe BrDanfe::DanfeLib::NfeLib::Ticket do
|
|
|
38
38
|
|
|
39
39
|
before do
|
|
40
40
|
subject.render
|
|
41
|
-
|
|
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
|
-
|
|
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
|
-
|
|
127
|
+
FileUtils.rm_f(output_pdf)
|
|
128
128
|
end
|
|
129
129
|
|
|
130
130
|
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 =
|
|
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 {
|
|
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 {
|
|
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 {
|
|
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 {
|
|
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
|
|
@@ -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 {
|
|
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 {
|
|
40
|
+
before { FileUtils.rm_f(output_pdf) }
|
|
41
41
|
|
|
42
42
|
it 'generates the title' do
|
|
43
43
|
title = 'Observações'
|
data/spec/br_danfe/mdfe_spec.rb
CHANGED
|
@@ -8,7 +8,7 @@ describe BrDanfe::Mdfe do
|
|
|
8
8
|
|
|
9
9
|
subject { described_class.new(xml) }
|
|
10
10
|
|
|
11
|
-
before {
|
|
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 =
|
|
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 {
|
|
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
|
|
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
|
-
<
|
|
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
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
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
|
-
|
|
1078
|
+
50874
|
|
1079
1079
|
%%EOF
|
|
@@ -17,7 +17,7 @@ endobj
|
|
|
17
17
|
>>
|
|
18
18
|
endobj
|
|
19
19
|
4 0 obj
|
|
20
|
-
<< /Length
|
|
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
|
-
<
|
|
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
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
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
|
-
|
|
1078
|
+
50874
|
|
1079
1079
|
%%EOF
|