Sha256: 2bfa266f267a8703d5ba4f97ea4d309b2c26a38d6b5c0282d5c5c2f63c0f3a6a

Contents?: true

Size: 1.74 KB

Versions: 6

Compression:

Stored size: 1.74 KB

Contents

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

# Only run on OS X
if RUBY_PLATFORM['darwin']

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', RakeBuilderHelper::SPEC_PATH )
    @expected_target  = Rake::Path.expand_with_root(
                          RakeBuilderHelper::TARGET[ :executable ],
                          RakeBuilderHelper::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

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rake-builder-0.7.0 spec/objective_c_project_spec.rb
rake-builder-0.0.19 spec/objective_c_project_spec.rb
rake-builder-0.0.18 spec/objective_c_project_spec.rb
rake-builder-0.0.17 spec/objective_c_project_spec.rb
rake-builder-0.0.16 spec/objective_c_project_spec.rb
rake-builder-0.0.15 spec/objective_c_project_spec.rb