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:
parent
1b002e6394
commit
e300d810f2
2 changed files with 14 additions and 1 deletions
|
@ -12,7 +12,10 @@ module Capistrano
|
||||||
|
|
||||||
task = find_task(old_name) or raise NoSuchTaskError, "the task `#{old_name}' does not exist"
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -37,6 +37,16 @@ class AliasTaskTest < Test::Unit::TestCase
|
||||||
assert_equal 42, @config.find_and_execute_task('new_foo')
|
assert_equal 42, @config.find_and_execute_task('new_foo')
|
||||||
end
|
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
|
def test_raise_exception_when_task_doesnt_exist
|
||||||
assert_raises(Capistrano::NoSuchTaskError) { @config.alias_task 'non_existant_task', 'fail_miserably' }
|
assert_raises(Capistrano::NoSuchTaskError) { @config.alias_task 'non_existant_task', 'fail_miserably' }
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue