Skip to content

Commit

Permalink
Merge pull request #140 from ruby/fix-regression-139
Browse files Browse the repository at this point in the history
Fix dependency task for Rake::TestTask
  • Loading branch information
hsbt authored Jun 12, 2016
2 parents 7ff501a + 4c7bb86 commit 90ab06b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/rake/testtask.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 8 additions & 1 deletion test/test_rake_test_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit 90ab06b

Please sign in to comment.