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.
- checksums.yaml +4 -4
- data/.github/workflows/config.yml +2 -2
- data/Gemfile +14 -0
- data/Gemfile.lock +59 -42
- data/README.md +10 -4
- data/br_danfe.gemspec +2 -13
- 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/document.rb +4 -4
- data/lib/br_danfe/danfe_lib/nfe_lib/infadic.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 +2 -2
- 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 +3 -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/cce/lib/barcode#render.pdf +14 -14
- data/spec/fixtures/cce/lib/correction#render.pdf +0 -0
- data/spec/fixtures/cce/lib/document#box.pdf +14 -14
- data/spec/fixtures/cce/lib/document#box.with.block.pdf +0 -0
- data/spec/fixtures/cce/lib/document#text.align.pdf +0 -0
- data/spec/fixtures/cce/lib/document#text.pad.pdf +0 -0
- data/spec/fixtures/cce/lib/document#text.simple.pdf +0 -0
- data/spec/fixtures/cce/lib/document#text.size.pdf +0 -0
- data/spec/fixtures/cce/lib/document#text.style.pdf +0 -0
- data/spec/fixtures/cce/lib/footer#render.pdf +0 -0
- data/spec/fixtures/cce/lib/header#render.pdf +0 -0
- data/spec/fixtures/cce/lib/nfe_key#render.pdf +0 -0
- data/spec/fixtures/cce/lib/protocol#render.pdf +0 -0
- data/spec/fixtures/cce/v1.00/cce.fixture.pdf +265 -149
- data/spec/fixtures/mdfe/lib/fisco_control#barcode.pdf +0 -0
- data/spec/fixtures/mdfe/lib/fisco_control#without-barcode.pdf +0 -0
- data/spec/fixtures/mdfe/lib/header#render-qr-code.pdf +0 -0
- data/spec/fixtures/mdfe/lib/header#render-with_logo.pdf +0 -0
- data/spec/fixtures/mdfe/lib/header#render-without-qr-code.pdf +0 -0
- data/spec/fixtures/mdfe/lib/header#render-without_logo.pdf +0 -0
- data/spec/fixtures/mdfe/lib/mdfe-with-multiple-pages.pdf +344 -176
- data/spec/fixtures/mdfe/lib/mdfe.fixture.pdf +336 -168
- data/spec/fixtures/mdfe/lib/notes#render-big-aditional-information.pdf +219 -151
- data/spec/fixtures/nfce/lib/document#render.pdf +20 -20
- data/spec/fixtures/nfce/lib/footer#render-with_additional_information.pdf +0 -0
- data/spec/fixtures/nfce/lib/footer#render.pdf +0 -0
- data/spec/fixtures/nfce/lib/header#render-homologation.pdf +0 -0
- data/spec/fixtures/nfce/lib/header#render-long_name_with_logo.pdf +0 -0
- data/spec/fixtures/nfce/lib/header#render-long_name_without_logo.pdf +0 -0
- data/spec/fixtures/nfce/lib/header#render-short_name_with_logo.pdf +0 -0
- data/spec/fixtures/nfce/lib/header#render-short_name_without_logo.pdf +0 -0
- data/spec/fixtures/nfce/lib/key#render.pdf +0 -0
- data/spec/fixtures/nfce/lib/nfce_identification#render.pdf +0 -0
- data/spec/fixtures/nfce/lib/product_list#render-with_many_products.pdf +0 -0
- data/spec/fixtures/nfce/lib/product_list#render-with_many_products_and_long_names.pdf +0 -0
- data/spec/fixtures/nfce/lib/product_list#render-with_single_product.pdf +0 -0
- data/spec/fixtures/nfce/lib/product_list#render-with_single_product_and_long_name.pdf +0 -0
- data/spec/fixtures/nfce/lib/recipient#render-company.pdf +0 -0
- data/spec/fixtures/nfce/lib/recipient#render-consumer_without_document.pdf +0 -0
- data/spec/fixtures/nfce/lib/recipient#render-foreign.pdf +0 -0
- data/spec/fixtures/nfce/lib/recipient#render-individual.pdf +0 -0
- data/spec/fixtures/nfce/lib/recipient#render-unidentified_consumer.pdf +0 -0
- data/spec/fixtures/nfce/lib/total_list#does_not_render-payment_methods.pdf +0 -0
- data/spec/fixtures/nfce/lib/total_list#render-grouped_payment_methods.pdf +0 -0
- data/spec/fixtures/nfce/lib/total_list#render-totals.pdf +0 -0
- data/spec/fixtures/nfce/lib/total_list#render-without_payment.pdf +0 -0
- data/spec/fixtures/nfce/lib/total_list#render.pdf +0 -0
- data/spec/fixtures/nfce/v4.00/multiples_xmls_on_the_same_pdf.pdf +336 -205
- data/spec/fixtures/nfce/v4.00/nfce-unauthorized-hom.fixture.pdf +0 -0
- data/spec/fixtures/nfce/v4.00/nfce-unauthorized-prod.fixture.pdf +0 -0
- data/spec/fixtures/nfce/v4.00/rendered_nfce.fixture.pdf +0 -0
- data/spec/fixtures/nfce/v4.00/saved_nfce.fixture.pdf +0 -0
- data/spec/fixtures/nfe/lib/dest#render-v2.00.pdf +0 -0
- data/spec/fixtures/nfe/lib/dest#render-v3.10.pdf +0 -0
- data/spec/fixtures/nfe/lib/dest#render-v4.00.pdf +0 -0
- data/spec/fixtures/nfe/lib/dest#render-with-address-bigger.pdf +0 -0
- data/spec/fixtures/nfe/lib/dest#render-with_cnpj.pdf +0 -0
- data/spec/fixtures/nfe/lib/dest#render-with_cpf.pdf +0 -0
- data/spec/fixtures/nfe/lib/dest#render-with_ie.pdf +0 -0
- data/spec/fixtures/nfe/lib/dest#render-without-address-complement.pdf +0 -0
- data/spec/fixtures/nfe/lib/det_body#render-csosn.pdf +144 -82
- data/spec/fixtures/nfe/lib/det_body#render-cst.pdf +129 -81
- data/spec/fixtures/nfe/lib/det_body#render-fci.pdf +124 -85
- data/spec/fixtures/nfe/lib/det_body#render-icms_st.pdf +133 -89
- data/spec/fixtures/nfe/lib/det_body#render-quantity_with_custom_precision.pdf +122 -84
- data/spec/fixtures/nfe/lib/det_body#render-three_pages.pdf +140 -85
- data/spec/fixtures/nfe/lib/det_body#render-two_pages.pdf +140 -85
- data/spec/fixtures/nfe/lib/det_body#render-unit_price_with_custom_precision.pdf +122 -84
- data/spec/fixtures/nfe/lib/det_body#render-with_entrega.pdf +118 -64
- data/spec/fixtures/nfe/lib/det_body#render-with_infadprod.pdf +131 -76
- data/spec/fixtures/nfe/lib/det_body#render-with_issqn.pdf +140 -85
- data/spec/fixtures/nfe/lib/det_body#render-without_issqn.pdf +140 -85
- data/spec/fixtures/nfe/lib/document#lcnpj-blank.pdf +0 -0
- data/spec/fixtures/nfe/lib/document#lcnpj-invalid.pdf +0 -0
- data/spec/fixtures/nfe/lib/document#lcnpj-valid.pdf +0 -0
- data/spec/fixtures/nfe/lib/document#lie-blank-uf-invalid.pdf +0 -0
- data/spec/fixtures/nfe/lib/document#lie-blank.pdf +0 -0
- data/spec/fixtures/nfe/lib/document#lie-invalid.pdf +0 -0
- data/spec/fixtures/nfe/lib/document#lie-valid.pdf +0 -0
- data/spec/fixtures/nfe/lib/dup#render-with_entrega.pdf +0 -0
- data/spec/fixtures/nfe/lib/dup#render.pdf +0 -0
- data/spec/fixtures/nfe/lib/emit_header#render-nfe_key.pdf +283 -151
- data/spec/fixtures/nfe/lib/emit_header#render-second_page.pdf +283 -151
- data/spec/fixtures/nfe/lib/emit_header#render-with_logo.pdf +283 -151
- data/spec/fixtures/nfe/lib/emit_header#render-without_logo.pdf +264 -132
- 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/lib/icmstot#render-with_entrega.pdf +0 -0
- data/spec/fixtures/nfe/lib/icmstot#render.pdf +0 -0
- data/spec/fixtures/nfe/lib/infadic#render-all_the_informations.pdf +0 -0
- data/spec/fixtures/nfe/lib/infadic#render-difal.pdf +0 -0
- data/spec/fixtures/nfe/lib/infadic#render-extra_volume.pdf +0 -0
- data/spec/fixtures/nfe/lib/infadic#render-with_complementary_information.pdf +0 -0
- data/spec/fixtures/nfe/lib/infadic#render-with_dup_additional_information.pdf +0 -0
- data/spec/fixtures/nfe/lib/infadic#render-with_fisco_additional_information.pdf +0 -0
- data/spec/fixtures/nfe/lib/infadic#render-with_street_data.pdf +0 -0
- data/spec/fixtures/nfe/lib/infadic#render-without_dup_additional_information.pdf +0 -0
- data/spec/fixtures/nfe/lib/infadic#render.pdf +0 -0
- data/spec/fixtures/nfe/lib/infadic_vol#render-extra_volume.pdf +0 -0
- data/spec/fixtures/nfe/lib/issqn#render-with_entrega.pdf +0 -0
- data/spec/fixtures/nfe/lib/issqn#render-with_issqn.pdf +0 -0
- data/spec/fixtures/nfe/lib/issqn#render-with_one_issqn_value.pdf +0 -0
- data/spec/fixtures/nfe/lib/issqn#render-without_issqn.pdf +14 -14
- data/spec/fixtures/nfe/lib/ticket#render.pdf +0 -0
- data/spec/fixtures/nfe/lib/ticket#render_with_dEmit.pdf +0 -0
- data/spec/fixtures/nfe/lib/ticket#render_with_dhEmit.pdf +0 -0
- data/spec/fixtures/nfe/lib/transp#render-modfrete_0.pdf +0 -0
- data/spec/fixtures/nfe/lib/transp#render-modfrete_1.pdf +0 -0
- data/spec/fixtures/nfe/lib/transp#render-modfrete_2.pdf +0 -0
- data/spec/fixtures/nfe/lib/transp#render-modfrete_3.pdf +0 -0
- data/spec/fixtures/nfe/lib/transp#render-modfrete_4.pdf +0 -0
- data/spec/fixtures/nfe/lib/transp#render-modfrete_9.pdf +0 -0
- data/spec/fixtures/nfe/lib/transp#render-with_entrega.pdf +0 -0
- data/spec/fixtures/nfe/lib/transp#render.pdf +0 -0
- data/spec/fixtures/nfe/lib/vol#render-blank-boxes.pdf +0 -0
- data/spec/fixtures/nfe/lib/vol#render-with_entrega.pdf +0 -0
- data/spec/fixtures/nfe/lib/vol#render.pdf +0 -0
- data/spec/fixtures/nfe/v2.00/custom_options.fixture.pdf +312 -185
- data/spec/fixtures/nfe/v2.00/nfe_simples_nacional.xml.fixture.pdf +293 -166
- data/spec/fixtures/nfe/v2.00/nfe_with_entrega.xml.fixture.pdf +296 -166
- data/spec/fixtures/nfe/v2.00/nfe_with_extra_volumes.xml.fixture.pdf +419 -221
- data/spec/fixtures/nfe/v2.00/nfe_with_fci.xml.fixture.pdf +311 -163
- data/spec/fixtures/nfe/v2.00/nfe_with_ns.xml.fixture.pdf +309 -171
- data/spec/fixtures/nfe/v2.00/nfe_without_ns.xml.fixture.pdf +303 -152
- data/spec/fixtures/nfe/v3.10/multiples.xmls.on.the.same.pdf.pdf +320 -152
- data/spec/fixtures/nfe/v3.10/nfe_simples_nacional.xml.fixture.pdf +312 -144
- data/spec/fixtures/nfe/v3.10/with_footer.fixture.pdf +323 -169
- data/spec/fixtures/nfe/v3.10/with_issqn.fixture.pdf +314 -138
- data/spec/fixtures/nfe/v3.10/with_three_pages.fixture.pdf +330 -159
- data/spec/fixtures/nfe/v3.10/without_issqn.fixture.pdf +319 -148
- data/spec/fixtures/qr_code/qr_code#render.pdf +0 -0
- metadata +7 -160
@@ -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
|
@@ -117,7 +117,7 @@ describe BrDanfe::DanfeLib::NfeLib::Document do
|
|
117
117
|
describe '#lcnpj' 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
|
@@ -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
|
@@ -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
|
@@ -6,14 +6,14 @@
|
|
6
6
|
>>
|
7
7
|
endobj
|
8
8
|
2 0 obj
|
9
|
-
<< /
|
10
|
-
/
|
9
|
+
<< /Pages 3 0 R
|
10
|
+
/Type /Catalog
|
11
11
|
>>
|
12
12
|
endobj
|
13
13
|
3 0 obj
|
14
|
-
<< /
|
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
|
-
<< /
|
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
|
-
/
|
499
|
-
/
|
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
|
-
<< /
|
512
|
+
<< /Info 1 0 R
|
513
513
|
/Root 2 0 R
|
514
|
-
/
|
514
|
+
/Size 6
|
515
515
|
>>
|
516
516
|
startxref
|
517
517
|
6392
|
Binary file
|
@@ -6,14 +6,14 @@
|
|
6
6
|
>>
|
7
7
|
endobj
|
8
8
|
2 0 obj
|
9
|
-
<< /
|
10
|
-
/
|
9
|
+
<< /Pages 3 0 R
|
10
|
+
/Type /Catalog
|
11
11
|
>>
|
12
12
|
endobj
|
13
13
|
3 0 obj
|
14
|
-
<< /
|
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
|
-
<< /
|
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
|
-
/
|
41
|
-
/
|
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
|
-
<< /
|
54
|
+
<< /Info 1 0 R
|
55
55
|
/Root 2 0 R
|
56
|
-
/
|
56
|
+
/Size 6
|
57
57
|
>>
|
58
58
|
startxref
|
59
59
|
588
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|