summaryrefslogtreecommitdiff
path: root/spec/api_spec.rb
blob: 5053fdcf0cae89ba1ea2f2bb4ee72046c96b1127 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# frozen_string_literal: true

require_relative 'spec_helper'

describe 'API' do
  context 'Asciidoctor.convert' do
    it 'should return an instance of Prawn::Document' do
      output = to_pdf 'hello', analyze: :document
      (expect output).to be_a Asciidoctor::PDF::Converter
      (expect output).to be_a Prawn::Document
      (expect output.render).to start_with '%PDF'
    end
  end

  context 'Asciidoctor.convert_file' do
    it 'should return a doc whose converter is a Prawn::Document' do
      input_file = Pathname.new fixture_file 'hello.adoc'
      output = to_pdf input_file, to_dir: output_dir, analyze: :document
      (expect output).to be_a Asciidoctor::PDF::Converter
      (expect output).to be_a Prawn::Document
      (expect output.render).to start_with '%PDF'
    end
  end
end