Sha256: 29b9fdb1292b9657ddc2236fbe2b0ff08be94f4bad53113574f98bae6d3ca161

Contents?: true

Size: 1.33 KB

Versions: 65

Compression:

Stored size: 1.33 KB

Contents

require "spec_helper"

describe SC::Target, 'prepare!' do

  include SC::SpecHelpers

  before do
    @project = fixture_project(:real_world)

    # get target from project manually since target_for() calls prepare!
    @target = @project.targets[:'/contacts']

    @target.buildfile.define! do
      replace_task 'target:prepare' do
        TARGET.task_did_run = (TARGET.task_did_run || 0) + 1
      end
    end

  end

  it "should return self" do
    @target.prepare!.should eql(@target)
  end

  it "should execute target:prepare if defined" do
    @target.prepared?.should be_false # check precondition
    @target.prepare!
    @target.prepared?.should be_true
    @target.task_did_run.should eql(1) # ran?
  end

  it "should do nothing if target:prepare is not defined" do

    # get an empty project with no build tasks...
    project = empty_project
    project.add_target '/default', :default, :source_root => project.project_root
    target = project.targets[:'/default']
    target.buildfile.lookup('target:prepare').should be_nil

    lambda { target.prepare! }.should_not raise_error

  end

  it "should execute target:prepare only once" do
    @target.prepared?.should be_false # check precondition
    @target.prepare!.prepare!.prepare!
    @target.prepared?.should be_true
    @target.task_did_run.should eql(1) # ran only once?
  end

end


Version data entries

65 entries across 65 versions & 1 rubygems

Version Path
sproutcore-1.11.0 spec/lib/models/target/prepare_spec.rb
sproutcore-1.11.0.rc3 spec/lib/models/target/prepare_spec.rb
sproutcore-1.11.0.rc2 spec/lib/models/target/prepare_spec.rb
sproutcore-1.11.0.rc1 spec/lib/models/target/prepare_spec.rb
sproutcore-1.10.3.1 spec/lib/models/target/prepare_spec.rb
sproutcore-1.10.2 spec/lib/models/target/prepare_spec.rb
sproutcore-1.10.1 spec/lib/models/target/prepare_spec.rb
sproutcore-1.10.0 spec/lib/models/target/prepare_spec.rb
sproutcore-1.10.0.rc.3 spec/lib/models/target/prepare_spec.rb
sproutcore-1.10.0.rc.2 spec/lib/models/target/prepare_spec.rb
sproutcore-1.10.0.rc.1 spec/lib/models/target/prepare_spec.rb
sproutcore-1.9.2 spec/lib/models/target/prepare_spec.rb
sproutcore-1.9.1 spec/lib/models/target/prepare_spec.rb
sproutcore-1.9.0 spec/lib/models/target/prepare_spec.rb
sproutcore-1.8.2.1 spec/lib/models/target/prepare_spec.rb
sproutcore-1.8.1 spec/lib/models/target/prepare_spec.rb
sproutcore-1.8.0 spec/lib/models/target/prepare_spec.rb
sproutcore-1.7.1.beta-java spec/lib/models/target/prepare_spec.rb
sproutcore-1.7.1.beta spec/lib/models/target/prepare_spec.rb
sproutcore-1.6.0.1-java spec/lib/models/target/prepare_spec.rb