Permalink
Browse files

update Rails::Railtie::Configuration and ActionDispatch::Response#res…

…pond_to? to accept include_private argument
  • Loading branch information...
1 parent 82139b9 commit 703452cce2dbb70b7c63fe7fe758da641010c150 @jonkessler jonkessler committed with arthurnn Aug 16, 2013
View
2 actionpack/lib/action_dispatch/http/response.rb
@@ -169,7 +169,7 @@ def message
end
alias_method :status_message, :message
- def respond_to?(method)
+ def respond_to?(method, include_private = false)
if method.to_s == 'to_path'
stream.respond_to?(:to_path)
else
View
5 actionpack/test/dispatch/response_test.rb
@@ -214,6 +214,11 @@ def test_response_body_encoding
ActionDispatch::Response.default_headers = nil
end
end
+
+ test "respond_to? accepts include_private" do
+ assert_not @response.respond_to?(:method_missing)
+ assert @response.respond_to?(:method_missing, true)
+ end
end
class ResponseIntegrationTest < ActionDispatch::IntegrationTest
View
2 railties/lib/rails/railtie/configuration.rb
@@ -80,7 +80,7 @@ def to_prepare(&blk)
to_prepare_blocks << blk if blk
end
- def respond_to?(name)
+ def respond_to?(name, include_private = false)
super || @@options.key?(name.to_sym)
end
View
7 railties/test/application/configuration_test.rb
@@ -679,5 +679,12 @@ def index
end
assert_equal Logger::INFO, Rails.logger.level
end
+
+ test "respond_to? accepts include_private" do
+ make_basic_app
+
+ assert_not Rails.configuration.respond_to?(:method_missing)
+ assert Rails.configuration.respond_to?(:method_missing, true)
+ end
end
end

0 comments on commit 703452c

Please sign in to comment.