Sha256: 733595bb0b055747cbc637e6f0069b813e0cfd6d445a6182e7afbb1514214648

Contents?: true

Size: 1.1 KB

Versions: 2

Compression:

Stored size: 1.1 KB

Contents

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

class TestRakeDsl < Rake::TestCase

  def test_namespace_command
    namespace "n" do
      task "t"
    end
    refute_nil Rake::Task["n:t"]
  end

  def test_namespace_command_with_bad_name
    ex = assert_raises(ArgumentError) do
      namespace 1 do end
    end
    assert_match(/string/i, ex.message)
    assert_match(/symbol/i, ex.message)
  end

  def test_namespace_command_with_a_string_like_object
    name = Object.new
    def name.to_str
      "bob"
    end
    namespace name do
      task "t"
    end
    refute_nil Rake::Task["bob:t"]
  end

  class Foo
    def initialize
      task :foo_deprecated_a => "foo_deprecated_b" do
        print "a"
      end
      file "foo_deprecated_b" do
        print "b"
      end
    end
  end

  def test_deprecated_object_dsl
    out, err = capture_io do
      Foo.new
      Rake.application.invoke_task :foo_deprecated_a
    end
    assert_equal("ba", out)
    assert_match(/deprecated/, err)
    assert_match(/Foo\#task/, err)
    assert_match(/Foo\#file/, err)
    assert_match(/test_rake_dsl\.rb:\d+/, err)
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
drake-0.9.1.0.3.0 test/test_rake_dsl.rb
rake-0.9.1 test/test_rake_dsl.rb