Sha256: e87bdcc446664b3e8f884b12bc27698312c154d3b30d0707cb1624ea42150238

Contents?: true

Size: 702 Bytes

Versions: 7

Compression:

Stored size: 702 Bytes

Contents

require 'spec_helper'

describe Quby::PdfRenderer do
  describe '#render_pdf' do
    it 'calls the html service with the given html string and returns the body' do
      expect(RestClient).to receive(:post).with(ENV['GOTENBERG_URL'], upload: { file: instance_of(StringIO)}).and_return(double(body: 'nice'))
      expect(described_class.render_pdf('nice')).to eq('nice')
    end

    it 'raises EmptyResponse if the response body is empty' do
      expect(RestClient).to receive(:post).with(ENV['GOTENBERG_URL'], upload: { file: instance_of(StringIO)}).and_return(double(body: ''))
      expect { described_class.render_pdf('nice') }.to raise_exception(described_class::EmptyResponse)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
quby-5.6.6 spec/quby/pdf_renderer_spec.rb
quby-5.6.5 spec/quby/pdf_renderer_spec.rb
quby-5.6.3 spec/quby/pdf_renderer_spec.rb
quby-5.6.2 spec/quby/pdf_renderer_spec.rb
quby-5.6.1 spec/quby/pdf_renderer_spec.rb
quby-5.6.0 spec/quby/pdf_renderer_spec.rb
quby-5.5.0 spec/quby/pdf_renderer_spec.rb