spec/features/danfe_spec.rb in br_danfe-0.6.1 vs spec/features/danfe_spec.rb in br_danfe-0.7.0
- old
+ new
@@ -96,8 +96,53 @@
danfe = BrDanfe::Danfe.new(File.read("#{base_dir}nfe_simples_nacional.xml"))
danfe.save_pdf output_pdf
expect("#{base_dir}nfe_simples_nacional.xml.fixture.pdf").to have_same_content_of file: output_pdf
end
+
+ context "when there are more than one page" do
+ it "renders xml to the pdf" do
+ expect(File.exist?(output_pdf)).to be_falsey
+
+ danfe = BrDanfe::Danfe.new(File.read("#{base_dir}with_three_pages.xml"))
+ danfe.save_pdf output_pdf
+
+ expect("#{base_dir}with_three_pages.fixture.pdf").to have_same_content_of file: output_pdf
+ end
+ end
+
+ context "when there is ISSQN" do
+ it "renders xml to the pdf" do
+ expect(File.exist?(output_pdf)).to be_falsey
+
+ danfe = BrDanfe::Danfe.new(File.read("#{base_dir}with_issqn.xml"))
+ danfe.save_pdf output_pdf
+
+ expect("#{base_dir}with_issqn.fixture.pdf").to have_same_content_of file: output_pdf
+ end
+ end
+
+ context "when there isn't ISSQN" do
+ it "renders xml to the pdf" do
+ expect(File.exist?(output_pdf)).to be_falsey
+
+ danfe = BrDanfe::Danfe.new(File.read("#{base_dir}withot_issqn.xml"))
+ danfe.save_pdf output_pdf
+
+ expect("#{base_dir}withot_issqn.fixture.pdf").to have_same_content_of file: output_pdf
+ end
+ end
+
+ context "when there is footer information" do
+ it "renders xml to the pdf" do
+ expect(File.exist?(output_pdf)).to be_falsey
+
+ footer = "Gerado através do Teste"
+ danfe = BrDanfe::Danfe.new(File.read("#{base_dir}with_footer.xml"))
+ danfe.save_pdf output_pdf, footer
+
+ expect("#{base_dir}with_footer.fixture.pdf").to have_same_content_of file: output_pdf
+ end
+ end
end
end
end