Sha256: fcbb8d2f2d1eb5d56c4e7b51d7984ec85ddc9fb8ffcdf9816fa4eed3be361bc2

Contents?: true

Size: 1.31 KB

Versions: 65

Compression:

Stored size: 1.31 KB

Contents

require "buildtasks/build/spec_helper"

describe "build:copy" do

  include SC::SpecHelpers
  include SC::BuildSpecHelpers

  before do
    std_before
    @task_name = 'build:copy'

    @entry = @manifest.entry_for('demo.html')
    @src_path = @entry.source_path
    @dst_path = @entry.build_path

    @entry.build_task.should == 'build:copy' # precondition
  end

  after do
    std_after
  end

  it "copies from source to dst_path if dst_path does not exist" do
    File.exist?(@dst_path).should be_false # precondition

    run_task @entry, @dst_path
    files_eql(@src_path, @dst_path).should be_true
  end

  it "does not run if newer file exists at dst_path" do
    write_dummy(@dst_path)
    make_newer(@dst_path, @src_path)

    run_task

    is_dummy(@dst_path).should be_true # make sure task did not copy
  end

  it "replaces dst_path if older file exists at dst_path" do
    write_dummy(@dst_path)
    make_newer(@src_path, @dst_path)

    run_task

    is_dummy(@dst_path).should be_false # should overrwite older file
    files_eql(@src_path, @dst_path).should be_true
  end

  it "does not run if dst_path == src_path" do
    task = @buildfile.lookup('build:copy')
    expected_count = task.execute_count

    @dst_path = @src_path
    run_task

    task.execute_count.should == expected_count # did not execute!
  end


end

Version data entries

65 entries across 65 versions & 1 rubygems

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