From f985028bcca353b3f873fc194c45eda4286b827b Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Wed, 24 Aug 2022 09:54:02 -0700 Subject: [PATCH 1/2] Stop gap solution for long output on test cases This patch just changes the inspect method on test case instances. Seeing test instance internals probably isn't helpful when an exception is raised (for example a `NoMethodError`). This isn't as good as #45122, but should fix #45121 --- activesupport/lib/active_support/test_case.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/activesupport/lib/active_support/test_case.rb b/activesupport/lib/active_support/test_case.rb index 289b152f8ecb9..528d3e143a76b 100644 --- a/activesupport/lib/active_support/test_case.rb +++ b/activesupport/lib/active_support/test_case.rb @@ -149,5 +149,9 @@ def parallelize_teardown(&block) alias :assert_not_same :refute_same ActiveSupport.run_load_hooks(:active_support_test_case, self) + + def inspect # :nodoc: + "#<#{self.class.name}:#{'%#016x' % object_id}>" + end end end From 63c9c79d675c5c2412a86b4c206fdaa16801e446 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Wed, 24 Aug 2022 10:54:04 -0700 Subject: [PATCH 2/2] Update activesupport/lib/active_support/test_case.rb Co-authored-by: John Hawthorn --- activesupport/lib/active_support/test_case.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activesupport/lib/active_support/test_case.rb b/activesupport/lib/active_support/test_case.rb index 528d3e143a76b..0778cb7c8636c 100644 --- a/activesupport/lib/active_support/test_case.rb +++ b/activesupport/lib/active_support/test_case.rb @@ -151,7 +151,7 @@ def parallelize_teardown(&block) ActiveSupport.run_load_hooks(:active_support_test_case, self) def inspect # :nodoc: - "#<#{self.class.name}:#{'%#016x' % object_id}>" + Object.instance_method(:to_s).bind_call(self) end end end