Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions lib/br_danfe/danfe_lib/nfce_lib/header.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ def x_position
@logo.present? ? 2.2.cm : 0
end

def width_box
@logo.present? ? 4.5.cm : 6.7.cm
end

def cnpj(info)
cnpj = BrDocuments::CnpjCpf::Cnpj.new info
"CNPJ: #{cnpj.valid? ? cnpj.formatted : ''}"
Expand Down
12 changes: 12 additions & 0 deletions spec/br_danfe/cce_lib/document_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,16 @@
end
end
end

describe 'delegating unknown methods to the underlying Prawn document' do
context 'when the underlying document also does not know the method' do
it 'raises NoMethodError' do
expect { subject.this_method_does_not_exist }.to raise_error(NoMethodError)
end

it 'does not respond to it' do
expect(subject.respond_to?(:this_method_does_not_exist)).to be_falsey
end
end
end
end
12 changes: 12 additions & 0 deletions spec/br_danfe/danfe_lib/nfce_lib/document_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,16 @@

expect("#{base_dir}document#render.pdf").to have_same_content_of file: output_pdf
end

describe 'delegating unknown methods to the underlying Prawn document' do
context 'when the underlying document also does not know the method' do
it 'raises NoMethodError' do
expect { subject.this_method_does_not_exist }.to raise_error(NoMethodError)
end

it 'does not respond to it' do
expect(subject.respond_to?(:this_method_does_not_exist)).to be_falsey
end
end
end
end
12 changes: 12 additions & 0 deletions spec/br_danfe/danfe_lib/nfe_lib/document_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -194,4 +194,16 @@
end
end
end

describe 'delegating unknown methods to the underlying Prawn document' do
context 'when the underlying document also does not know the method' do
it 'raises NoMethodError' do
expect { subject.this_method_does_not_exist }.to raise_error(NoMethodError)
end

it 'does not respond to it' do
expect(subject.respond_to?(:this_method_does_not_exist)).to be_falsey
end
end
end
end
10 changes: 9 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
require 'simplecov'
SimpleCov.start unless ENV["NO_COVERAGE"]

unless ENV["NO_COVERAGE"]
SimpleCov.start do
add_filter '/spec/support/'

# Prawn internals monkey-patch, not br_danfe's own logic.
add_filter '/lib/prawn/'
end
end

require "bundler/setup"
require "br_danfe"
Expand Down
Loading