Sha256: 18533fe415cd89ca213b8934347cda7daddddbadb18c9f8d7c10397a9cbdcbab

Contents?: true

Size: 1.7 KB

Versions: 6

Compression:

Stored size: 1.7 KB

Contents

require 'spec_helper'

describe Rake::Builder::Presenters::MakefileAm::BuilderCollectionPresenter do
  context '.new' do
    it 'takes one parameter' do
      expect {
        Rake::Builder::Presenters::MakefileAm::BuilderCollectionPresenter.new
      }.to raise_error(ArgumentError, 'wrong number of arguments (0 for 1)')
    end
  end

  context '#to_s' do
    let(:program_builder) { stub('Rake::Builder', :label => 'the_program', :is_library? => false) }
    let(:library_builder) { stub('Rake::Builder', :label => 'the_library', :is_library? => true) }
    let(:builders) { [program_builder, library_builder] }

    subject { Rake::Builder::Presenters::MakefileAm::BuilderCollectionPresenter.new(builders) }

    before do
      Rake::Builder::Presenters::MakefileAm::BuilderPresenter.
        stub(:new).
        with(program_builder).
        and_return("AAA\nBBB\n")
      Rake::Builder::Presenters::MakefileAm::BuilderPresenter.
        stub(:new).
        with(library_builder).
        and_return("XXX\nYYY\n")
    end

    it 'lists libraries' do
      expect(subject.to_s).to include("lib_LIBRARIES = the_library\n\n")
    end

    it 'lists programs' do
      expect(subject.to_s).to include("bin_PROGRAMS = the_program\n\n")
    end

    it 'includes builder text' do
      Rake::Builder::Presenters::MakefileAm::BuilderPresenter.
        should_receive(:new).
        with(program_builder).
        and_return("AAA\nBBB\n")
      Rake::Builder::Presenters::MakefileAm::BuilderPresenter.
        should_receive(:new).
        with(library_builder).
        and_return("XXX\nYYY\n")

      output = subject.to_s

      expect(output).to include("AAA\nBBB\n")
      expect(output).to include("XXX\nYYY\n")
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rake-builder-0.9.1 spec/unit/rake/builder/presenters/makefile_am/builder_collection_presenter_spec.rb
rake-builder-0.9.0 spec/unit/rake/builder/presenters/makefile_am/builder_collection_presenter_spec.rb
rake-builder-0.8.0 spec/unit/rake/builder/presenters/makefile_am/builder_collection_presenter_spec.rb
rake-builder-0.7.0 spec/unit/rake/builder/presenters/makefile_am/builder_collection_presenter_spec.rb
rake-builder-0.0.19 spec/unit/rake/builder/presenters/makefile_am/builder_collection_presenter_spec.rb
rake-builder-0.0.18 spec/unit/rake/builder/presenters/makefile_am/builder_collection_presenter_spec.rb