Permalink
Browse files

Fail gracefully when double-colons are used to delimit namespaces (cl…

…oses #10472)

git-svn-id: http://svn.rubyonrails.org/rails/tools/capistrano@8758 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent b4a0d3c commit a7a256956d8c198bfc6f521ae53f212802518fa0 @jamis jamis committed Jan 31, 2008
Showing with 12 additions and 1 deletion.
  1. +2 −0 CHANGELOG
  2. +2 −1 lib/capistrano/configuration/namespaces.rb
  3. +8 −0 test/configuration/namespace_dsl_test.rb
View
@@ -1,5 +1,7 @@
*SVN*
+* Fail gracefully when double-colons are used to delimit namespaces [richie]
+
* Add support for :git_enable_submodules variable, to enable submodules with the git SCM [halorgium]
* If subversion asks for a password, prompt as a last resort [Jamis Buck]
@@ -116,7 +116,8 @@ def find_task(name)
ns = self
until parts.empty?
- ns = ns.namespaces[parts.shift.to_sym]
+ next_part = parts.shift
+ ns = next_part.empty? ? nil : ns.namespaces[next_part.to_sym]
return nil if ns.nil?
end
@@ -294,4 +294,12 @@ def test_top_should_return_topmost_parent_if_self_is_deeply_nested
@config.namespace(:outer) { namespace(:middle) { namespace(:inner) {} } }
assert_equal @config, @config.namespaces[:outer].namespaces[:middle].namespaces[:inner].top
end
+
+ def test_find_task_should_return_nil_when_empty_inner_task
+ @config.namespace :outer do
+ namespace :inner do
+ end
+ end
+ assert_nil @config.find_task("outer::inner")
+ end
end

0 comments on commit a7a2569

Please sign in to comment.