summaryrefslogtreecommitdiff
path: root/spec/pdf_info_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/pdf_info_spec.rb')
-rw-r--r--spec/pdf_info_spec.rb34
1 files changed, 27 insertions, 7 deletions
diff --git a/spec/pdf_info_spec.rb b/spec/pdf_info_spec.rb
index c6ffb078..8b36d819 100644
--- a/spec/pdf_info_spec.rb
+++ b/spec/pdf_info_spec.rb
@@ -30,14 +30,34 @@ describe 'Asciidoctor::PDF::Converter - PDF Info' do
end
it 'should set Author and Producer field to value of author attribute if set' do
- pdf = to_pdf <<~'EOS'
- = Document Title
- Author Name
+ ['Author Name', ':author: Author Name'].each do |author_line|
+ pdf = to_pdf <<~EOS
+ = Document Title
+ #{author_line}
+
+ content
+ EOS
+ (expect pdf.info[:Producer]).to eql pdf.info[:Author]
+ (expect pdf.info[:Author]).to eql 'Author Name'
+ end
+ end
- content
- EOS
- (expect pdf.info[:Producer]).to eql pdf.info[:Author]
- (expect pdf.info[:Author]).to eql 'Author Name'
+ it 'should set Author and Producer field to value of author attribute if set to multiple authors' do
+ ['Author Name; Assistant Name', ':authors: Author Name; Assistant Name'].each do |author_line|
+ pdf = to_pdf <<~EOS
+ = Document Title
+ #{author_line}
+
+ [%hardbreaks]
+ First Author: {author_1}
+ Second Author: {author_2}
+ EOS
+ lines = ((pdf.page 1).text.split ?\n).map &:strip
+ (expect pdf.info[:Producer]).to eql pdf.info[:Author]
+ (expect pdf.info[:Author]).to eql 'Author Name, Assistant Name'
+ (expect lines).to include 'First Author: Author Name'
+ (expect lines).to include 'Second Author: Assistant Name'
+ end
end
it 'should set Producer field to value of publisher attribute if set' do