提交 ba5fab4c 编写于 作者: J Jon Kessler

update Rails::Railtie::Configuration and ActionDispatch::Response#respond_to?...

update Rails::Railtie::Configuration and ActionDispatch::Response#respond_to? to accept include_private argument
上级 5c6e11d6
......@@ -181,7 +181,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
......
......@@ -212,6 +212,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
......
......@@ -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
......
......@@ -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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册