summaryrefslogtreecommitdiff
path: root/spec/image_spec.rb
blob: 505cb22e7e7c3f3be8740ef41782edae0327a16d (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
25
26
27
28
29
30
31
32
# frozen_string_literal: true

require_relative 'spec_helper'
require 'asciidoctor-diagram'

describe 'Asciidoctor::Epub3::Converter - Image' do
  it 'supports imagesoutdir != imagesdir != "{base_dir}/images"' do
    book, out_file = to_epub 'diagram/book.adoc'
    out_dir = out_file.dirname

    expect(out_dir.join('a', 'a.png')).to exist
    expect(out_dir.join('b', 'b.png')).to exist
    expect(out_dir.join('c.png')).to exist
    expect(out_dir.join('d', 'plantuml.png')).to exist

    expect(book).to have_item_with_href('a/a.png')
    expect(book).to have_item_with_href('b/b.png')
    expect(book).to have_item_with_href('c.png')
    expect(book).to have_item_with_href('d/plantuml.png')
  end

  it 'supports inline images' do
    book, out_file = to_epub 'inline-image/book.adoc'
    out_dir = out_file.dirname

    expect(out_dir.join('imagez', 'inline-diag.png')).to exist

    expect(book).to have_item_with_href('imagez/inline-diag.png')
    expect(book).to have_item_with_href('imagez/square.png')
    expect(book).to have_item_with_href('imagez/wolpertinger.jpg')
  end
end