Sha256: 2638bb36c9c7ce672ddf7c4cb0fb9279b2aef8e40f1ad9295c1bfceb13df1cc8

Contents?: true

Size: 1.85 KB

Versions: 1

Compression:

Stored size: 1.85 KB

Contents

require "spec_helper"

describe "RubyDanfe generated pdf files" do
  let(:base_dir) { "./spec/fixtures/"}
  let(:output_pdf) { "#{base_dir}output.pdf" }

  before {
    File.delete(output_pdf) if File.exist?(output_pdf)
    RubyDanfe.options = {"quantity_decimals" => 2}
  }

  it "renders a basic NF-e with namespace" do
    expect(File.exist?(output_pdf)).to be_false

    RubyDanfe.generate(output_pdf, "#{base_dir}nfe_with_ns.xml")

    expect("#{base_dir}nfe_with_ns.xml.fixture.pdf").to be_same_file_as(output_pdf)
  end

  it "renders another basic NF-e without namespace" do
    expect(File.exist?(output_pdf)).to be_false

    RubyDanfe.generate(output_pdf, "#{base_dir}nfe_without_ns.xml")

    expect("#{base_dir}nfe_without_ns.xml.fixture.pdf").to be_same_file_as(output_pdf)
  end

  it "renders a NF-e having FCI in its items" do
    expect(File.exist?(output_pdf)).to be_false

    RubyDanfe.generate(output_pdf, "#{base_dir}nfe_with_fci.xml")

    expect("#{base_dir}nfe_with_fci.xml.fixture.pdf").to be_same_file_as(output_pdf)
  end

  it "renders a NF-e of Simples Nacional using CSOSN" do
    expect(File.exist?(output_pdf)).to be_false

    RubyDanfe.generate(output_pdf, "#{base_dir}nfe_simples_nacional.xml")

    expect("#{base_dir}nfe_simples_nacional.xml.fixture.pdf").to be_same_file_as(output_pdf)
  end

  it "renders a basic CT-e" do
    expect(File.exist?(output_pdf)).to be_false

    RubyDanfe.generate(output_pdf, "#{base_dir}cte.xml", :dacte)

    expect("#{base_dir}cte.xml.fixture.pdf").to be_same_file_as(output_pdf)
  end

  it "renders quantity field with 4 decimals" do
    expect(File.exist?(output_pdf)).to be_false

    RubyDanfe.generate(output_pdf, "#{base_dir}4_decimals_nfe_simples_nacional.xml", :danfe, {"quantity_decimals" => 4})

    expect("#{base_dir}4_decimals_nfe_simples_nacional.xml.fixture.pdf").to be_same_file_as(output_pdf)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby_danfe-1.11.5 spec/features/ruby_danfe_spec.rb