1
0
Fork 0
mirror of https://github.com/capistrano/capistrano synced 2023-03-27 23:21:18 -04:00

Ticket #193 - alias_task preserve description

This commit is contained in:
Rafa García 2011-05-08 18:42:22 +02:00
parent 1b002e6394
commit e300d810f2
2 changed files with 14 additions and 1 deletions

View file

@ -12,7 +12,10 @@ module Capistrano
task = find_task(old_name) or raise NoSuchTaskError, "the task `#{old_name}' does not exist"
task(new_name, task.options, &task.body)
options = {}
options[:desc] = task.description
task(new_name, options, &task.body)
end
end
end

View file

@ -37,6 +37,16 @@ class AliasTaskTest < Test::Unit::TestCase
assert_equal 42, @config.find_and_execute_task('new_foo')
end
def test_aliased_task_should_preserve_description
@config.task(:foo, :desc => "the Ultimate Question of Life, the Universe, and Everything" ) { 42 }
@config.alias_task 'new_foo', 'foo'
task = @config.find_task('foo')
new_task = @config.find_task('new_foo')
assert_equal task.description, new_task.description
end
def test_raise_exception_when_task_doesnt_exist
assert_raises(Capistrano::NoSuchTaskError) { @config.alias_task 'non_existant_task', 'fail_miserably' }
end