Sha256: 38e0104ee1e1b9314435cb638eb5fa506f771e62aa874c54b7f27f5198de84c7

Contents?: true

Size: 1.4 KB

Versions: 33

Compression:

Stored size: 1.4 KB

Contents

require 'spec_helper'

describe Softcover::Commands::Build do
  before(:all) { generate_book }
  after(:all)  { remove_book }

  context 'valid builder formats' do
    Softcover::FORMATS.each do |format|
      subject { Softcover::Commands::Build.builder_for(format) }
      it { should be_a Softcover::Builder }
    end
  end

  context 'invalid builder format' do
    subject { lambda { Softcover::Commands::Build.for_format('derp') } }

    it { should raise_error }
  end

  context 'building all' do
    subject(:build) { Softcover::Commands::Build }

    it { should respond_to(:all_formats) }
    it "should build all formats" do
      pdf_builder  = build.builder_for('pdf')
      mobi_builder = build.builder_for('mobi')

      pdf_builder .should_receive(:build!)
      mobi_builder.should_receive(:build!)

      build.should_receive(:builder_for).with('pdf') .and_return(pdf_builder)
      build.should_receive(:builder_for).with('mobi').and_return(mobi_builder)

      build.all_formats
    end
  end

  context 'building previews' do
    subject(:build) { Softcover::Commands::Build }

    it { should respond_to(:preview) }
    it "should build previews" do
      preview_builder = build.builder_for('preview')
      preview_builder.should_receive(:build!)
      build.should_receive(:builder_for).with('preview').
                                         and_return(preview_builder)
      build.preview
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
softcover-0.8.9 spec/commands/build_spec.rb
softcover-0.8.8 spec/commands/build_spec.rb
softcover-0.8.7 spec/commands/build_spec.rb
softcover-0.8.6 spec/commands/build_spec.rb
softcover-0.8.5 spec/commands/build_spec.rb
softcover-0.8.4 spec/commands/build_spec.rb
softcover-0.8.3 spec/commands/build_spec.rb
softcover-0.8.2 spec/commands/build_spec.rb
softcover-0.8.1 spec/commands/build_spec.rb
softcover-0.8.0 spec/commands/build_spec.rb
softcover-0.7.11 spec/commands/build_spec.rb
softcover-0.7.10 spec/commands/build_spec.rb
softcover-0.7.9 spec/commands/build_spec.rb
softcover-0.7.8 spec/commands/build_spec.rb
softcover-0.7.7 spec/commands/build_spec.rb
softcover-0.7.6 spec/commands/build_spec.rb
softcover-0.7.5 spec/commands/build_spec.rb
softcover-0.7.4 spec/commands/build_spec.rb
softcover-0.7.3 spec/commands/build_spec.rb
softcover-0.7.2 spec/commands/build_spec.rb