diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2020-10-09 02:53:45 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-10-09 02:53:45 -0600 |
| commit | 22acfe26ea77da8b88a7b86126df8a5f9d2ddea8 (patch) | |
| tree | 745720b4e56150ec5210c56fa73dd747684f3292 /spec/optimizer_spec.rb | |
| parent | e52c38dad689b409197969ee47c25002eba538e1 (diff) | |
resolves #1791 allow path of ghostscript command to be controlled using `GS` env var (PR #1792)
Diffstat (limited to 'spec/optimizer_spec.rb')
| -rw-r--r-- | spec/optimizer_spec.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/optimizer_spec.rb b/spec/optimizer_spec.rb index 7f03cea1..3d67245a 100644 --- a/spec/optimizer_spec.rb +++ b/spec/optimizer_spec.rb @@ -95,6 +95,18 @@ describe 'Asciidoctor::PDF::Optimizer' do (expect pdf_info[:Producer]).to include 'Ghostscript' end + it 'should use ghostscript command specified by GS environment variable', cli: true do + input_file = Pathname.new example_file 'basic-example.adoc' + to_file = to_pdf_file input_file, 'optimizer-cli-with-custom-gs.pdf' + env = windows? ? {} : { 'GS' => '/usr/bin/gs' } + out, err, res = run_command asciidoctor_pdf_optimize_bin, '--quality', 'prepress', to_file, env: env + (expect res.exitstatus).to be 0 + (expect out).to be_empty + (expect err).to be_empty + pdf_info = (PDF::Reader.new to_file).info + (expect pdf_info[:Producer]).to include 'Ghostscript' + end + it 'should not crash if quality passed to asciidoctor-pdf-optimizer CLI is not recognized', cli: true do input_file = Pathname.new example_file 'basic-example.adoc' to_file = to_pdf_file input_file, 'optimizer-cli-fallback-quality.pdf' |
