From 4c7bb867f6aadf45c33bbd512c94c294eff586aa Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Sun, 12 Jun 2016 09:50:50 +0900 Subject: [PATCH] Rake 11.2.0 broke dependency task of Rake::TestTask, If it's given. It needs to extract TestLib dependency --- lib/rake/testtask.rb | 4 ++++ test/test_rake_test_task.rb | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/rake/testtask.rb b/lib/rake/testtask.rb index 27ad790af..9d5d88a02 100644 --- a/lib/rake/testtask.rb +++ b/lib/rake/testtask.rb @@ -93,6 +93,10 @@ def initialize(name=:test) @ruby_opts = [] @description = "Run tests" + (@name == :test ? "" : " for #{@name}") @deps = [] + if @name.is_a?(Hash) + @deps = @name.values + @name = @name.keys.first + end yield self if block_given? @pattern = 'test/test*.rb' if @pattern.nil? && @test_files.nil? define diff --git a/test/test_rake_test_task.rb b/test/test_rake_test_task.rb index 9b27bfdd8..17167d74b 100644 --- a/test/test_rake_test_task.rb +++ b/test/test_rake_test_task.rb @@ -16,8 +16,15 @@ def test_initialize assert Task.task_defined?(:test) end + def test_initialize_deps + tt = Rake::TestTask.new(:example => :bar) + refute_nil tt + assert_equal [:bar], tt.deps + assert Task.task_defined?(:example) + end + def test_initialize_override - tt = Rake::TestTask.new(:example) do |t| + tt = Rake::TestTask.new(:example => :bar) do |t| t.description = "Run example tests" t.libs = ['src', 'ext'] t.pattern = 'test/tc_*.rb'