Sha256: 1abda72322d34f0e8baf41e69809354dedef86ad7e8079449e9bc33f0e5a853c

Contents?: true

Size: 1.46 KB

Versions: 64

Compression:

Stored size: 1.46 KB

Contents

require File.expand_path('../helper', __FILE__)
require 'fileutils'

class TestRakeDirectoryTask < Rake::TestCase
  include Rake

  def test_directory
    desc "DESC"

    directory "a/b/c"

    assert_equal FileCreationTask, Task["a"].class
    assert_equal FileCreationTask, Task["a/b"].class
    assert_equal FileCreationTask, Task["a/b/c"].class

    assert_nil             Task["a"].comment
    assert_nil             Task["a/b"].comment
    assert_equal "DESC",   Task["a/b/c"].comment

    verbose(false) {
      Task['a/b'].invoke
    }

    assert File.exist?("a/b")
    refute File.exist?("a/b/c")
  end

  if Rake::Win32.windows?
    def test_directory_win32
      desc "WIN32 DESC"
      directory 'c:/a/b/c'
      assert_equal FileTask, Task['c:'].class
      assert_equal FileCreationTask, Task['c:/a'].class
      assert_equal FileCreationTask, Task['c:/a/b'].class
      assert_equal FileCreationTask, Task['c:/a/b/c'].class
      assert_nil             Task['c:/'].comment
      assert_equal "WIN32 DESC",   Task['c:/a/b/c'].comment
      assert_nil             Task['c:/a/b'].comment
    end
  end

  def test_can_use_blocks
    runlist = []

    t1 = directory("a/b/c" => :t2) { |t| runlist << t.name }
    t2 = task(:t2) { |t| runlist << t.name }

    verbose(false) {
      t1.invoke
    }

    assert_equal Task["a/b/c"], t1
    assert_equal FileCreationTask, Task["a/b/c"].class
    assert_equal ["t2", "a/b/c"], runlist
    assert File.directory?("a/b/c")
  end
end

Version data entries

64 entries across 50 versions & 19 rubygems

Version Path
rubyjobbuilderdsl-0.0.2 vendor/bundle/ruby/2.1.0/gems/rake-0.9.6/test/test_rake_directory_task.rb
rubyjobbuilderdsl-0.0.1 vendor/bundle/ruby/2.1.0/gems/rake-0.9.6/test/test_rake_directory_task.rb
active_mailer-0.0.10 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/test/test_rake_directory_task.rb
judge-2.0.5 vendor/bundle/ruby/2.1.0/gems/rake-10.0.3/test/test_rake_directory_task.rb
torquebox-console-0.3.0 vendor/bundle/jruby/1.9/gems/rake-10.0.3/test/test_rake_directory_task.rb
active_mailer-0.0.9 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/test/test_rake_directory_task.rb
active_mailer-0.0.8 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/test/test_rake_directory_task.rb
active_mailer-0.0.7 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/test/test_rake_directory_task.rb
active_mailer-0.0.6 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/test/test_rake_directory_task.rb
font-awesome-rails-3.1.1.2 vendor/ruby/2.0.0/gems/rake-10.0.3/test/test_rake_directory_task.rb
font-awesome-rails-3.1.1.2 vendor/ruby/1.9.1/gems/rake-10.0.3/test/test_rake_directory_task.rb
font-awesome-rails-3.1.1.1 vendor/ruby/1.9.1/gems/rake-10.0.3/test/test_rake_directory_task.rb
font-awesome-rails-3.1.1.1 vendor/ruby/2.0.0/gems/rake-10.0.3/test/test_rake_directory_task.rb
librarian-puppet-0.9.9 vendor/gems/ruby/1.9.1/gems/rake-10.0.3/test/test_rake_directory_task.rb
challah-1.0.0.beta vendor/bundle/gems/rake-10.0.3/test/test_rake_directory_task.rb
torquebox-console-0.2.5 vendor/bundle/ruby/1.8/gems/rake-10.0.3/test/test_rake_directory_task.rb
torquebox-console-0.2.5 vendor/bundle/jruby/1.9/gems/rake-10.0.3/test/test_rake_directory_task.rb
vagrant-actionio-0.0.9 vendor/bundle/gems/rake-10.0.3/test/test_rake_directory_task.rb
torquebox-console-0.2.4 vendor/bundle/jruby/1.9/gems/rake-10.0.3/test/test_rake_directory_task.rb
torquebox-console-0.2.4 vendor/bundle/ruby/1.8/gems/rake-10.0.3/test/test_rake_directory_task.rb