summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2022-06-24 23:57:58 -0600
committerDan Allen <dan.j.allen@gmail.com>2022-06-25 01:58:34 -0600
commitd79aa880304203aa5cf920ea39ce0e06d37a6e45 (patch)
treecd5507f8016cf7624ce9f1472dfa56876e0b2d87
parent1d22c4cb9405429dacd793d4abf8e44131d25a71 (diff)
assert file in addition to lineno in warning message for cannot fit error
-rw-r--r--spec/spec_helper.rb1
-rw-r--r--spec/table_spec.rb4
2 files changed, 3 insertions, 2 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 3250e887..27feb36c 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -764,6 +764,7 @@ RSpec::Matchers.define :have_message do |expected|
elsif message_text === expected_message
result = true
end
+ result = false if (file = expected[:file]) && !(Hash === message_data && file == message_data[:source_location].file)
result = false if (lineno = expected[:lineno]) && !(Hash === message_data && lineno == message_data[:source_location].lineno)
end
actual = message
diff --git a/spec/table_spec.rb b/spec/table_spec.rb
index 15fe7bdc..829203c3 100644
--- a/spec/table_spec.rb
+++ b/spec/table_spec.rb
@@ -806,7 +806,7 @@ describe 'Asciidoctor::PDF::Converter - Table' do
it 'should report file and line number in cannot fit error if sourcemap is enabled' do
(expect do
- pdf = to_pdf <<~'EOS', sourcemap: true, analyze: true
+ pdf = to_pdf <<~'EOS', sourcemap: true, attribute_overrides: { 'docfile' => 'test.adoc' }, analyze: true
before table
[cols="2m,49,49"]
@@ -820,7 +820,7 @@ describe 'Asciidoctor::PDF::Converter - Table' do
(expect text).to have_size 2
(expect text[0][:string]).to eql 'before table'
(expect text[1][:string]).to eql 'after table'
- end).to log_message severity: :ERROR, message: 'cannot fit contents of table cell into specified column width', lineno: 4
+ end).to log_message severity: :ERROR, message: 'cannot fit contents of table cell into specified column width', file: 'test.adoc', lineno: 4
end
it 'should not fail to fit text in cell' do