Skip to content
Browse files

Allow respond_to?() to accept include_priv parameter

This is necessary for cap to work with certain frameworks,
like rspec.
  • Loading branch information...
1 parent 9ba526d commit 0290a690387ac2195054994fba89563335da72f4 @roidrage roidrage committed with jamis Jan 29, 2009
View
2 CHANGELOG.rdoc
@@ -1,5 +1,7 @@
== (unreleased)
+* Allow respond_to?() method to accept optional second parameter (include_priv) [Mathias Meyer]
+
* Make sure sudo prompts are retried correctly even if "try again" and the prompt appear in the same text chunk from the server [Jamis Buck]
* Add supported environment variables to -H output [François Beausoleil]
View
4 lib/capistrano/configuration/namespaces.rb
@@ -177,8 +177,8 @@ def role(*args)
raise NotImplementedError, "roles cannot be defined in a namespace"
end
- def respond_to?(sym)
- super || parent.respond_to?(sym)
+ def respond_to?(sym, include_priv=false)
+ super || parent.respond_to?(sym, include_priv)
end
def method_missing(sym, *args, &block)
View
4 lib/capistrano/configuration/variables.rb
@@ -111,8 +111,8 @@ def protect(variable)
end
private :protect
- def respond_to_with_variables?(sym) #:nodoc:
- @variables.has_key?(sym) || respond_to_without_variables?(sym)
+ def respond_to_with_variables?(sym, include_priv=false) #:nodoc:
+ @variables.has_key?(sym) || respond_to_without_variables?(sym, include_priv)
end
def method_missing_with_variables(sym, *args, &block) #:nodoc:
View
6 test/configuration/namespace_dsl_test.rb
@@ -238,6 +238,12 @@ def test_namespace_should_respond_to_its_parents_methods
ns = @config.namespaces[:outer]
assert ns.respond_to?(:original_initialize_called)
end
+
+ def test_namespace_should_accept_respond_to_with_include_priv_parameter
+ @config.namespace(:outer) {}
+ ns = @config.namespaces[:outer]
+ assert ns.respond_to?(:original_initialize_called, true)
+ end
def test_namespace_should_delegate_unknown_messages_to_its_parent
@config.namespace(:outer) {}
View
4 test/configuration/variables_test.rb
@@ -53,6 +53,10 @@ def test_respond_to_should_look_for_variables
@config[:sample] = :value
assert @config.respond_to?(:sample)
end
+
+ def test_respond_to_with_include_priv_paramter
+ assert !@config.respond_to?(:sample, true)
+ end
def test_set_should_require_value
assert_raises(ArgumentError) do

0 comments on commit 0290a69

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