未验证 提交 46bdcbf9 编写于 作者: K Kasper Timm Hansen 提交者: GitHub

Merge pull request #40172 from p8/shorten-inspect-on-controller

Shorten inspect on AbstractController::Base
......@@ -204,6 +204,10 @@ def self.supports_path?
true
end
def inspect # :nodoc:
"#<#{self.class.name}:#{'%#016x' % (object_id << 1)}>"
end
private
# Returns true if the name can be considered an action because
# it has a method defined in the controller.
......
......@@ -147,6 +147,10 @@ def test_response_has_default_headers
ensure
ActionDispatch::Response.default_headers = original_default_headers
end
def test_inspect
assert_match(/\A#<EmptyController:0x[0-9a-f]+>\z/, @empty.inspect)
end
end
class PerformActionTest < ActionController::TestCase
......
......@@ -29,4 +29,9 @@ def test_response_does_not_have_default_headers
ensure
ActionDispatch::Response.default_headers = original_default_headers
end
def test_inspect
controller = SimpleController.new
assert_match(/\A#<MetalControllerInstanceTests::SimpleController:0x[0-9a-f]+>\z/, controller.inspect)
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册