Sha256: d145106758dad3860b69a9adc5b409f671b77b5dba4da967eea74abe65302d1c

Contents?: true

Size: 1.34 KB

Versions: 2

Compression:

Stored size: 1.34 KB

Contents

load File.dirname(__FILE__) + '/spec_helper.rb'

describe 'when creating tasks' do

  before( :each ) do
    Rake::Task.clear
  end

  after( :each ) do
    `rm -f spec/.rake-builder.foo`
  end

  it 'raises an error when the target is an empty string' do
    lambda do
      Rake::Builder.new do |builder|
        builder.target = ''
        builder.source_search_paths = [ 'cpp_project' ]
      end
    end.should raise_error(Rake::Builder::Error, 'The target name cannot be an empty string')
  end

  it 'raises an error when the target is set to nil' do
    lambda do
      Rake::Builder.new do |builder|
        builder.target = nil
        builder.source_search_paths = [ 'cpp_project' ]
      end
    end.should raise_error(Rake::Builder::Error, 'The target name cannot be nil')
  end

  it 'sets the target to \'a.out\' if it is not set' do
    builder = Rake::Builder.new do |builder|
      builder.source_search_paths = [ 'cpp_project' ]
    end
    builder.target.should == Rake::Path.expand_with_root( 'a.out', RakeBuilderHelper::SPEC_PATH )
  end

  it 'raises an error when the supplied target_type is unknown' do
    lambda do
      project = Rake::Builder.new do |builder|
        builder.target      = 'my_prog'
        builder.target_type = :foo
        builder.source_search_paths = [ 'cpp_project' ]
      end
    end.should raise_error
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rake-builder-0.7.0 spec/target_spec.rb
rake-builder-0.0.19 spec/target_spec.rb