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.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +25 -25
  3. data/lib/br_danfe/danfe.rb +52 -25
  4. data/lib/br_danfe/danfe_lib/det_body.rb +105 -46
  5. data/lib/br_danfe/danfe_lib/document.rb +3 -7
  6. data/lib/br_danfe/danfe_lib/emit_header.rb +36 -20
  7. data/lib/br_danfe/danfe_lib/infadic.rb +12 -12
  8. data/lib/br_danfe/danfe_lib/issqn.rb +19 -8
  9. data/lib/br_danfe/version.rb +1 -1
  10. data/spec/features/danfe_spec.rb +45 -0
  11. data/spec/fixtures/nfe/lib/det_body#render-csosn.pdf +1932 -332
  12. data/spec/fixtures/nfe/lib/det_body#render-cst.pdf +1182 -138
  13. data/spec/fixtures/nfe/lib/det_body#render-fci.pdf +809 -43
  14. data/spec/fixtures/nfe/lib/det_body#render-icms_st.pdf +809 -43
  15. data/spec/fixtures/nfe/lib/det_body#render-quantity_with_custom_precision.pdf +807 -41
  16. data/spec/fixtures/nfe/lib/det_body#render-three_pages.pdf +22414 -0
  17. data/spec/fixtures/nfe/lib/det_body#render-two_pages.pdf +21442 -0
  18. data/spec/fixtures/nfe/lib/det_body#render-unit_price_with_custom_precision.pdf +807 -41
  19. data/spec/fixtures/nfe/lib/det_body#render-with_infadprod.pdf +1012 -0
  20. data/spec/fixtures/nfe/lib/det_body#render-with_issqn.pdf +10124 -0
  21. data/spec/fixtures/nfe/lib/det_body#render-without_issqn.pdf +10124 -0
  22. data/spec/fixtures/nfe/lib/emit_header#render-second_page.pdf +792 -0
  23. data/spec/fixtures/nfe/lib/emit_header#render-with_logo.pdf +88 -8
  24. data/spec/fixtures/nfe/lib/emit_header#render-without_logo.pdf +85 -5
  25. data/spec/fixtures/nfe/lib/infadic#render-footer_information.pdf +111 -0
  26. data/spec/fixtures/nfe/lib/{issqn#render.pdf → issqn#render-with_issqn.pdf} +0 -0
  27. data/spec/fixtures/nfe/lib/issqn#render-with_one_issqn_value.pdf +129 -0
  28. data/spec/fixtures/nfe/lib/issqn#render-without_issqn.pdf +54 -0
  29. data/spec/fixtures/nfe/v2.00/custom_options.fixture.pdf +2190 -1067
  30. data/spec/fixtures/nfe/v2.00/nfe_simples_nacional.xml.fixture.pdf +2183 -1059
  31. data/spec/fixtures/nfe/v2.00/nfe_with_extra_volumes.xml.fixture.pdf +8803 -3208
  32. data/spec/fixtures/nfe/v2.00/nfe_with_fci.xml.fixture.pdf +1825 -1258
  33. data/spec/fixtures/nfe/v2.00/nfe_with_ns.xml.fixture.pdf +8609 -3014
  34. data/spec/fixtures/nfe/v2.00/nfe_without_ns.xml.fixture.pdf +2664 -1541
  35. data/spec/fixtures/nfe/v3.10/nfe_simples_nacional.xml.fixture.pdf +4701 -1909
  36. data/spec/fixtures/nfe/v3.10/with_footer.fixture.pdf +8660 -0
  37. data/spec/fixtures/nfe/v3.10/with_footer.xml +621 -0
  38. data/spec/fixtures/nfe/v3.10/with_issqn.fixture.pdf +8646 -0
  39. data/spec/fixtures/nfe/v3.10/with_issqn.xml +621 -0
  40. data/spec/fixtures/nfe/v3.10/with_three_pages.fixture.pdf +25420 -0
  41. data/spec/fixtures/nfe/v3.10/with_three_pages.xml +1281 -0
  42. data/spec/fixtures/nfe/v3.10/withot_issqn.fixture.pdf +10338 -0
  43. data/spec/fixtures/nfe/v3.10/withot_issqn.xml +688 -0
  44. data/spec/lib/danfe_lib/det_body_spec.rb +350 -264
  45. data/spec/lib/danfe_lib/emit_header_spec.rb +42 -18
  46. data/spec/lib/danfe_lib/issqn_spec.rb +39 -7
  47. metadata +38 -14
  48. data/lib/br_danfe/danfe_lib/det_header.rb +0 -40
  49. data/lib/br_danfe/danfe_lib/emit.rb +0 -23
  50. data/spec/fixtures/nfe/lib/det_header#render.pdf +0 -207
  51. data/spec/fixtures/nfe/lib/emit#render.pdf +0 -143
  52. data/spec/lib/danfe_lib/det_header_spec.rb +0 -26
  53. data/spec/lib/danfe_lib/emit_spec.rb +0 -60
@@ -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