br_danfe 0.6.1 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +25 -25
- data/lib/br_danfe/danfe.rb +52 -25
- data/lib/br_danfe/danfe_lib/det_body.rb +105 -46
- data/lib/br_danfe/danfe_lib/document.rb +3 -7
- data/lib/br_danfe/danfe_lib/emit_header.rb +36 -20
- data/lib/br_danfe/danfe_lib/infadic.rb +12 -12
- data/lib/br_danfe/danfe_lib/issqn.rb +19 -8
- data/lib/br_danfe/version.rb +1 -1
- data/spec/features/danfe_spec.rb +45 -0
- data/spec/fixtures/nfe/lib/det_body#render-csosn.pdf +1932 -332
- data/spec/fixtures/nfe/lib/det_body#render-cst.pdf +1182 -138
- data/spec/fixtures/nfe/lib/det_body#render-fci.pdf +809 -43
- data/spec/fixtures/nfe/lib/det_body#render-icms_st.pdf +809 -43
- data/spec/fixtures/nfe/lib/det_body#render-quantity_with_custom_precision.pdf +807 -41
- data/spec/fixtures/nfe/lib/det_body#render-three_pages.pdf +22414 -0
- data/spec/fixtures/nfe/lib/det_body#render-two_pages.pdf +21442 -0
- data/spec/fixtures/nfe/lib/det_body#render-unit_price_with_custom_precision.pdf +807 -41
- data/spec/fixtures/nfe/lib/det_body#render-with_infadprod.pdf +1012 -0
- data/spec/fixtures/nfe/lib/det_body#render-with_issqn.pdf +10124 -0
- data/spec/fixtures/nfe/lib/det_body#render-without_issqn.pdf +10124 -0
- data/spec/fixtures/nfe/lib/emit_header#render-second_page.pdf +792 -0
- data/spec/fixtures/nfe/lib/emit_header#render-with_logo.pdf +88 -8
- data/spec/fixtures/nfe/lib/emit_header#render-without_logo.pdf +85 -5
- data/spec/fixtures/nfe/lib/infadic#render-footer_information.pdf +111 -0
- data/spec/fixtures/nfe/lib/{issqn#render.pdf → issqn#render-with_issqn.pdf} +0 -0
- data/spec/fixtures/nfe/lib/issqn#render-with_one_issqn_value.pdf +129 -0
- data/spec/fixtures/nfe/lib/issqn#render-without_issqn.pdf +54 -0
- data/spec/fixtures/nfe/v2.00/custom_options.fixture.pdf +2190 -1067
- data/spec/fixtures/nfe/v2.00/nfe_simples_nacional.xml.fixture.pdf +2183 -1059
- data/spec/fixtures/nfe/v2.00/nfe_with_extra_volumes.xml.fixture.pdf +8803 -3208
- data/spec/fixtures/nfe/v2.00/nfe_with_fci.xml.fixture.pdf +1825 -1258
- data/spec/fixtures/nfe/v2.00/nfe_with_ns.xml.fixture.pdf +8609 -3014
- data/spec/fixtures/nfe/v2.00/nfe_without_ns.xml.fixture.pdf +2664 -1541
- data/spec/fixtures/nfe/v3.10/nfe_simples_nacional.xml.fixture.pdf +4701 -1909
- data/spec/fixtures/nfe/v3.10/with_footer.fixture.pdf +8660 -0
- data/spec/fixtures/nfe/v3.10/with_footer.xml +621 -0
- data/spec/fixtures/nfe/v3.10/with_issqn.fixture.pdf +8646 -0
- data/spec/fixtures/nfe/v3.10/with_issqn.xml +621 -0
- data/spec/fixtures/nfe/v3.10/with_three_pages.fixture.pdf +25420 -0
- data/spec/fixtures/nfe/v3.10/with_three_pages.xml +1281 -0
- data/spec/fixtures/nfe/v3.10/withot_issqn.fixture.pdf +10338 -0
- data/spec/fixtures/nfe/v3.10/withot_issqn.xml +688 -0
- data/spec/lib/danfe_lib/det_body_spec.rb +350 -264
- data/spec/lib/danfe_lib/emit_header_spec.rb +42 -18
- data/spec/lib/danfe_lib/issqn_spec.rb +39 -7
- metadata +38 -14
- data/lib/br_danfe/danfe_lib/det_header.rb +0 -40
- data/lib/br_danfe/danfe_lib/emit.rb +0 -23
- data/spec/fixtures/nfe/lib/det_header#render.pdf +0 -207
- data/spec/fixtures/nfe/lib/emit#render.pdf +0 -143
- data/spec/lib/danfe_lib/det_header_spec.rb +0 -26
- data/spec/lib/danfe_lib/emit_spec.rb +0 -60
data/spec/features/danfe_spec.rb
CHANGED
@@ -98,6 +98,51 @@ describe BrDanfe::Danfe do
|
|
98
98
|
|
99
99
|
expect("#{base_dir}nfe_simples_nacional.xml.fixture.pdf").to have_same_content_of file: output_pdf
|
100
100
|
end
|
101
|
+
|
102
|
+
context "when there are more than one page" do
|
103
|
+
it "renders xml to the pdf" do
|
104
|
+
expect(File.exist?(output_pdf)).to be_falsey
|
105
|
+
|
106
|
+
danfe = BrDanfe::Danfe.new(File.read("#{base_dir}with_three_pages.xml"))
|
107
|
+
danfe.save_pdf output_pdf
|
108
|
+
|
109
|
+
expect("#{base_dir}with_three_pages.fixture.pdf").to have_same_content_of file: output_pdf
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
context "when there is ISSQN" do
|
114
|
+
it "renders xml to the pdf" do
|
115
|
+
expect(File.exist?(output_pdf)).to be_falsey
|
116
|
+
|
117
|
+
danfe = BrDanfe::Danfe.new(File.read("#{base_dir}with_issqn.xml"))
|
118
|
+
danfe.save_pdf output_pdf
|
119
|
+
|
120
|
+
expect("#{base_dir}with_issqn.fixture.pdf").to have_same_content_of file: output_pdf
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
context "when there isn't ISSQN" do
|
125
|
+
it "renders xml to the pdf" do
|
126
|
+
expect(File.exist?(output_pdf)).to be_falsey
|
127
|
+
|
128
|
+
danfe = BrDanfe::Danfe.new(File.read("#{base_dir}withot_issqn.xml"))
|
129
|
+
danfe.save_pdf output_pdf
|
130
|
+
|
131
|
+
expect("#{base_dir}withot_issqn.fixture.pdf").to have_same_content_of file: output_pdf
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
context "when there is footer information" do
|
136
|
+
it "renders xml to the pdf" do
|
137
|
+
expect(File.exist?(output_pdf)).to be_falsey
|
138
|
+
|
139
|
+
footer = "Gerado através do Teste"
|
140
|
+
danfe = BrDanfe::Danfe.new(File.read("#{base_dir}with_footer.xml"))
|
141
|
+
danfe.save_pdf output_pdf, footer
|
142
|
+
|
143
|
+
expect("#{base_dir}with_footer.fixture.pdf").to have_same_content_of file: output_pdf
|
144
|
+
end
|
145
|
+
end
|
101
146
|
end
|
102
147
|
end
|
103
148
|
end
|