Sha256: abe1c1c2cbff705155b730649920a661de643acfa51c4d4066bcca70dbaaa961

Contents?: true

Size: 1.23 KB

Versions: 2

Compression:

Stored size: 1.23 KB

Contents

require "spec_helper"

describe Kitabu::Exporter::HTML do
  let(:root) { SPECDIR.join("support/mybook") }
  let(:format) { described_class.new(root) }

  context "when generating HTML" do
    let(:file) { SPECDIR.join("support/mybook/output/mybook.html") }
    let(:html) { File.read(file) }
    before { format.export }

    it "generates valid markup", osx: RUBY_PLATFORM.include?('darwin') do
      `./vendor/bin/tidy5_osx '#{file}' 2>&1 > /dev/null`
      expect($?.exitstatus).to eq(0)
    end

    it "generates valid markup", linux: RUBY_PLATFORM.include?('linux') do
      `./vendor/bin/tidy5_linux '#{file}' 2>&1 > /dev/null`
      expect($?.exitstatus).to eq(0)
    end

    it "keeps html file around" do
      expect(file).to be_file
    end

    it "has several chapters" do
      expect(html).to have_tag("div.chapter", 3)
    end

    it "uses config file" do
      expect(html).to have_tag("div.imprint p", "Copyright (C) 2010 John Doe.")
    end

    it "renders changelog" do
      expect(html).to have_tag("div.changelog h2", "Revisions")
    end

    it "renders erb" do
      expect(html).to have_tag("h2", "ERB")
    end

    it "renders erb blocks" do
      expect(html).to have_tag("div.note.info > p", "This is a note!")
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
kitabu-2.0.3 spec/kitabu/exporter/html_spec.rb
kitabu-2.0.2 spec/kitabu/exporter/html_spec.rb