Sha256: e93673125b3933ee8697f95b339a447560eda4e63294eae31c2c08e2977150d1

Contents?: true

Size: 1.64 KB

Versions: 139

Compression:

Stored size: 1.64 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

  describe "commands helper" do
    let(:lines) { ['foo', ' #  bar', 'baz'] }
    subject { Softcover::Commands::Build.commands(lines) }

    it { should match /foo/ }
    it { should_not match /bar/ }
    it { should match /baz/ }
  end
end

Version data entries

139 entries across 139 versions & 2 rubygems

Version Path
softcover-1.1.10 spec/commands/build_spec.rb
softcover-1.1.9 spec/commands/build_spec.rb
softcover-1.1.8 spec/commands/build_spec.rb
softcover-1.1.7 spec/commands/build_spec.rb
softcover-1.1.6 spec/commands/build_spec.rb
softcover-1.1.4 spec/commands/build_spec.rb
softcover-1.1.3 spec/commands/build_spec.rb
softcover-1.1.2 spec/commands/build_spec.rb
softcover-1.1.1 spec/commands/build_spec.rb
softcover-1.1.0 spec/commands/build_spec.rb
softcover-1.1.beta2 spec/commands/build_spec.rb
softcover-1.0.5 spec/commands/build_spec.rb
softcover-1.1.beta1 spec/commands/build_spec.rb
softcover-1.0.4 spec/commands/build_spec.rb
softcover-1.0.3 spec/commands/build_spec.rb
softcover-1.0.2 spec/commands/build_spec.rb
softcover-1.0.1 spec/commands/build_spec.rb
softcover-1.0.0 spec/commands/build_spec.rb
softcover-1.0.beta17 spec/commands/build_spec.rb
softcover-1.0.beta16 spec/commands/build_spec.rb