Sha256: 26725a53c8a3182726695b486cdd754056d2e6ef0a9c8903e62b65ec3cf3ee43

Contents?: true

Size: 1.12 KB

Versions: 65

Compression:

Stored size: 1.12 KB

Contents

require "spec_helper"

describe SC::Buildfile, 'define' do

  it "should return new buildfile with task defined in block" do
    task_did_run = false
    b = SC::Buildfile.define do
      task :test_task do
        task_did_run = true
      end
    end

    b.should_not be_nil

    b.invoke :test_task
    task_did_run.should be_true
  end

  it "should inherit tasks defined by parent buildfile" do
    task1_did_run = false
    task2_did_run = false

    a = SC::Buildfile.define do
      task :test_task1 do
        task1_did_run = true
      end
    end

    b = a.dup.define! do
      task :test_task2 => :test_task1 do
        task2_did_run = true
      end
    end

    a.should_not be_nil
    b.should_not be_nil

    b.invoke :test_task2
    task1_did_run.should be_true
    task2_did_run.should be_true
  end

  it "should eval a string if passed to instance version" do

    # add accessor to test.
    a = SC::Buildfile.new.define! do
      def did_run; @did_run; end
    end

    # now try string eval...
    a.define! "task :test_task1 do\n@did_run = true\nend"

    a.invoke :test_task1
    a.did_run.should be_true
  end

end


Version data entries

65 entries across 65 versions & 1 rubygems

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