Sha256: b043191d45485e8ec7ae0b593bfa6337a0ada1318aee81201844e5d17949a107

Contents?: true

Size: 1.65 KB

Versions: 4

Compression:

Stored size: 1.65 KB

Contents

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

describe 'when building an Objective-C executable' do

  include RakeBuilderHelper

  before( :all ) do
    @test_output_file = Rake::Path.expand_with_root(
                          'rake-builder-testfile.txt', SPEC_PATH )
    @expected_target  = Rake::Path.expand_with_root(
                          RakeBuilderHelper::TARGET[ :executable ],
                          SPEC_PATH )
  end

  before( :each ) do
    Rake::Task.clear
    @project = objective_c_task( :executable )
    `rm -f #{ @test_output_file }`
    `rm -f #{ @project.target }`
  end

  after( :each ) do
    Rake::Task[ 'clean' ].invoke
    `rm -f #{ @test_output_file }`
  end

  it 'knows the target' do
    @project.target.should == @expected_target
  end

  it 'builds the target in the objects directory' do
    File.dirname( @project.target ).should == @project.objects_path
  end

  it 'knows the project type' do
    @project.target_type.should == :executable
  end

  it 'creates the correct tasks' do
    expected_tasks = expected_tasks( [ @project.target ] )
    missing_tasks = expected_tasks - task_names
    missing_tasks.should == []
  end

  it 'builds the program with \'build\'' do
    Rake::Task[ 'build' ].invoke
    exist?( @project.target ).should be_true
  end

  it 'has a \'run\' task' do
    Rake::Task[ 'run' ].should_not be_nil
  end

  it 'builds the program with \'run\'' do
    Rake::Task[ 'run' ].invoke
    exist?( @project.target ).should be_true
  end

  it 'runs the program with \'run\'' do
    lambda do
      Rake::Task[ 'run' ].invoke
    end.should_not raise_exception
    exist?( @test_output_file ).should be_true
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rake-builder-0.0.14 spec/objective_c_project_spec.rb
rake-builder-0.0.13 spec/objective_c_project_spec.rb
rake-builder-0.0.12 spec/objective_c_project_spec.rb
rake-builder-0.0.11 spec/objective_c_project_spec.rb