diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2019-08-31 23:35:34 -0600 |
|---|---|---|
| committer | Dan Allen <dan.j.allen@gmail.com> | 2019-08-31 23:35:34 -0600 |
| commit | b473ddfa4d83214adb32b0d27f41564ebaf108d5 (patch) | |
| tree | cbbe9e453814910c98c91b65cd30720ae3d7d1e8 | |
| parent | f36960ad3d6c6018939914228b40734b71c898f2 (diff) | |
verify :Author metadata field is set regardless of how authors are defined
| -rw-r--r-- | spec/pdf_info_spec.rb | 34 |
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 |
