Sha256: a32221f0ba7a059192714a2dd11fc1f9e4dcc5ea5dde8720513238feea6900ba

Contents?: true

Size: 1.46 KB

Versions: 9

Compression:

Stored size: 1.46 KB

Contents

require 'spec_helper'

describe Softcover::Builders::Preview do

  context "for a PolyTeX book" do
    before(:all) do
      generate_book
      @builder = Softcover::Builders::Preview.new
      @builder.build!
      chdir_to_book
    end
    after(:all) { remove_book }

    describe "#build!" do

      it "should build a PDF" do
        expect('ebooks/book-preview.pdf').to exist
      end

      context "EPUB & MOBI books" do
        it "should build an EPUB" do
          expect('ebooks/book-preview.epub').to exist
        end

        #
        # We don't test for MOBI because kindlegen doesn't work in tests.
        #

        it "should include the right chapters" do
          @builder.manifest.preview_chapters.each do |ch|
            expect(File.join('epub', 'OEBPS', ch.fragment_name)).to exist
          end
          nonpreview_chapters = @builder.manifest.chapters -
                                @builder.manifest.preview_chapters
          nonpreview_chapters.each do |ch|
            expect(File.join('epub', 'OEBPS', ch.fragment_name)).not_to exist
          end
        end
      end
    end
  end

  context "for a Markdown book" do
    before(:all) do
      generate_book(markdown: true)
      @builder = Softcover::Builders::Preview.new
      @builder.build!
      chdir_to_book
    end
    after(:all) { remove_book }

    describe "#build!" do

      it "should build a PDF" do
        expect('ebooks/book-preview.pdf').to exist
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
softcover-0.6.7 spec/builders/preview_spec.rb
softcover-0.6.6 spec/builders/preview_spec.rb
softcover-0.6.5 spec/builders/preview_spec.rb
softcover-0.6.4 spec/builders/preview_spec.rb
softcover-0.6.3 spec/builders/preview_spec.rb
softcover-0.6.2 spec/builders/preview_spec.rb
softcover-0.6.1 spec/builders/preview_spec.rb
softcover-0.6.0 spec/builders/preview_spec.rb
softcover-0.5.0 spec/builders/preview_spec.rb