Skip to content
Browse files

Merge pull request #155 from rgo/ticket-193-alias-task

Fix alias-task method naming in `cap -T`
  • Loading branch information...
2 parents c8139bf + f61fea1 commit 8a2e093d709dd42516e3e86d056776f920369a42 @leehambley leehambley committed Apr 12, 2012
Showing with 10 additions and 1 deletion.
  1. +2 −1 lib/capistrano/configuration/alias_task.rb
  2. +8 −0 test/configuration/alias_task_test.rb
View
3 lib/capistrano/configuration/alias_task.rb
@@ -15,7 +15,8 @@ def alias_task(new_name, old_name)
raise ArgumentError, "expected a valid task name"
end
- task = find_task(old_name) or raise NoSuchTaskError, "the task `#{old_name}' does not exist"
+ original_task = find_task(old_name) or raise NoSuchTaskError, "the task `#{old_name}' does not exist"
+ task = original_task.dup # Dup. task to avoid modify original task
task.name = new_name
define_task(task)
View
8 test/configuration/alias_task_test.rb
@@ -30,6 +30,14 @@ def test_makes_a_copy_of_the_task
assert @config.tasks.key?(:new_foo)
end
+ def test_original_task_remain_with_same_name
+ @config.task(:foo) { 42 }
+ @config.alias_task 'new_foo', 'foo'
+
+ assert_equal :foo, @config.tasks[:foo].name
+ assert_equal :new_foo, @config.tasks[:new_foo].name
+ end
+
def test_aliased_task_do_the_same
@config.task(:foo) { 42 }
@config.alias_task 'new_foo', 'foo'

0 comments on commit 8a2e093

Please sign in to comment.
Something went wrong with that request. Please try again.