Sha256: 24cab18d3e087f0382ba8e45ce2e67085faa823d76100d451eb70a0ff86b9e6f

Contents?: true

Size: 1.76 KB

Versions: 61

Compression:

Stored size: 1.76 KB

Contents

require 'spec_helper'

describe Softcover::Builders::Mobi do
  describe "#build!" do
    before(:all) do
      generate_book
      @builder = Softcover::Builders::Mobi.new
      @built = @builder.build!
      chdir_to_book
    end
    after(:all) { remove_book }

    it "should generate the MOBI" do
      expect('ebooks/book.mobi').to exist
    end

    describe "MOBI command" do
      context "default" do
        let(:command) do
          @builder.mobi_command(@builder.mobi_filename)
        end

        it "should use Calibre's ebook-convert" do
          expect(command).to include 'ebook-convert'
        end

        it "should build both kinds of Kindle files" do
          expect(command).to include ' --mobi-file-type both'
        end

        it "should include the cover" do
          expect(command).to include ' --cover epub/OEBPS/images/cover.jpg'
        end

        it "should configure the cover to work with Kindle desktop app" do
          expect(command).to include ' --share-not-sync'
        end
      end

      context "kindlegen" do
        let(:command) do
          @builder.mobi_command(@builder.mobi_filename, kindlegen: true)
        end
        it "should use Amazon.com's kindlegen" do
          expect(command).to include 'kindlegen'
        end
      end

      context "amazon" do
        let(:command) do
          @builder.mobi_command(@builder.mobi_filename, amazon: true)
        end
        it "should use Amazon.com's kindlegen" do
          expect(command).to include 'kindlegen'
        end
      end

      context "preview" do
        let(:filename) do
          @builder.mobi_filename(preview: true)
        end
        it "should create a preview file" do
          expect(filename).to include 'book-preview'
        end
      end
    end
  end
end

Version data entries

61 entries across 61 versions & 1 rubygems

Version Path
softcover-1.5.11 spec/builders/mobi_spec.rb
softcover-1.5.10 spec/builders/mobi_spec.rb
softcover-1.5.9 spec/builders/mobi_spec.rb
softcover-1.5.8 spec/builders/mobi_spec.rb
softcover-1.5.7 spec/builders/mobi_spec.rb
softcover-1.5.6 spec/builders/mobi_spec.rb
softcover-1.5.5 spec/builders/mobi_spec.rb
softcover-1.5.4 spec/builders/mobi_spec.rb
softcover-1.5.3 spec/builders/mobi_spec.rb
softcover-1.5.2 spec/builders/mobi_spec.rb
softcover-1.5.1 spec/builders/mobi_spec.rb
softcover-1.5.0 spec/builders/mobi_spec.rb
softcover-1.4.9 spec/builders/mobi_spec.rb
softcover-1.4.8 spec/builders/mobi_spec.rb
softcover-1.4.7 spec/builders/mobi_spec.rb
softcover-1.4.6 spec/builders/mobi_spec.rb
softcover-1.4.5 spec/builders/mobi_spec.rb
softcover-1.4.3 spec/builders/mobi_spec.rb
softcover-1.4.2 spec/builders/mobi_spec.rb
softcover-1.4.1 spec/builders/mobi_spec.rb