Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/rake/task_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ def [](task_name, scopes=nil)
end

def generate_message_for_undefined_task(task_name)
message = "Don't know how to build task '#{task_name}' (See the list of available tasks with `rake --tasks`)"
message = "Don't know how to build task '#{task_name}' "\
"(See the list of available tasks with `#{Rake.application.name} --tasks`)"
message + generate_did_you_mean_suggestions(task_name)
end

Expand Down
10 changes: 10 additions & 0 deletions test/test_rake_task_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ def test_index
assert_equal "Don't know how to build task 'bad' (See the list of available tasks with `rake --tasks`)", e.message
end

def test_undefined_task_with_custom_application
Rake.application.init("myrake", nil)

e = assert_raises RuntimeError do
@tm["bad"]
end

assert_equal "Don't know how to build task 'bad' (See the list of available tasks with `myrake --tasks`)", e.message
end

def test_name_lookup
t = @tm.define_task(Rake::Task, :t)
assert_equal t, @tm[:t]
Expand Down