Sha256: d2798ffc6a31cf8f4dcf806f1014086263e914e0f89f7936edc90871e6f90522

Contents?: true

Size: 1.01 KB

Versions: 30

Compression:

Stored size: 1.01 KB

Contents

require 'spec_helper'

describe Softcover::Builders::Preview 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

      it "should build an EPUB" do
        expect('ebooks/book-preview.mobi').to exist
      end

      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

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
softcover-0.7.7 spec/builders/preview_spec.rb
softcover-0.7.6 spec/builders/preview_spec.rb
softcover-0.7.5 spec/builders/preview_spec.rb
softcover-0.7.4 spec/builders/preview_spec.rb
softcover-0.7.3 spec/builders/preview_spec.rb
softcover-0.7.2 spec/builders/preview_spec.rb
softcover-0.7.1 spec/builders/preview_spec.rb
softcover-0.7.0 spec/builders/preview_spec.rb
softcover-0.6.10 spec/builders/preview_spec.rb
softcover-0.6.9 spec/builders/preview_spec.rb