Sha256: ddcdad604f42bd068d6c403252114440a043c2b67078904e43f20d565f1bff13

Contents?: true

Size: 1.72 KB

Versions: 20

Compression:

Stored size: 1.72 KB

Contents

require File.join(File.dirname(__FILE__), %w[.. .. .. spec_helper])

describe SC::Manifest, 'prepare!' do
  
  include SC::SpecHelpers
  
  before do
    @project = fixture_project(:real_world)
    @target = @project.target_for :contacts
    
    @target.buildfile.define! do
      
      replace_task 'target:prepare' do
        # avoid invoking original machinery...
      end
      
      replace_task 'manifest:prepare' do
        MANIFEST.task_did_run = (MANIFEST.task_did_run || 0) + 1
      end
    end
    
    @manifest = @target.manifest_for(:language => :en)
  end

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

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

  it "should do nothing if manifest: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('manifest:prepare').should be_nil
    
    manifest = target.manifest_for :language => :en
    lambda { manifest.prepare! }.should_not raise_error
    
  end
  
  it "should execute manifest:prepare only once" do
    @manifest.prepared?.should be_false # check precondition
    @manifest.prepare!.prepare!.prepare!
    @manifest.prepared?.should be_true
    @manifest.task_did_run.should eql(1) # ran only once?
  end
  
end

Version data entries

20 entries across 20 versions & 2 rubygems

Version Path
sproutit-sproutcore-1.0.0.20090407205609 spec/lib/models/manifest/prepare_spec.rb
sproutit-sproutcore-1.0.0.20090408130025 spec/lib/models/manifest/prepare_spec.rb
sproutit-sproutcore-1.0.0.20090416161445 spec/lib/models/manifest/prepare_spec.rb
sproutit-sproutcore-1.0.20090721145236 spec/lib/models/manifest/prepare_spec.rb
sproutcore-1.0.1046 spec/lib/models/manifest/prepare_spec.rb
sproutcore-1.0.1043 spec/lib/models/manifest/prepare_spec.rb
sproutcore-1.0.1042 spec/lib/models/manifest/prepare_spec.rb
sproutcore-1.0.1037 spec/lib/models/manifest/prepare_spec.rb
sproutcore-1.0.1035 spec/lib/models/manifest/prepare_spec.rb
sproutcore-1.0.1031 spec/lib/models/manifest/prepare_spec.rb
sproutcore-1.0.1030 spec/lib/models/manifest/prepare_spec.rb
sproutcore-1.0.1029 spec/lib/models/manifest/prepare_spec.rb
sproutcore-1.0.1027 spec/lib/models/manifest/prepare_spec.rb
sproutcore-1.0.1028 spec/lib/models/manifest/prepare_spec.rb
sproutcore-1.0.1026 spec/lib/models/manifest/prepare_spec.rb
sproutcore-1.0.1025 spec/lib/models/manifest/prepare_spec.rb
sproutcore-1.0.1024 spec/lib/models/manifest/prepare_spec.rb
sproutcore-1.0.1009 spec/lib/models/manifest/prepare_spec.rb
sproutcore-1.0.1008 spec/lib/models/manifest/prepare_spec.rb
sproutcore-1.0.1003 spec/lib/models/manifest/prepare_spec.rb