diff options
author | Sean Griffin <sean@thoughtbot.com> | 2015-01-23 16:25:15 -0700 |
---|---|---|
committer | Sean Griffin <sean@thoughtbot.com> | 2015-01-23 16:25:15 -0700 |
commit | 847395a04df52a389823ff4367c4b002cdbb5c6a (patch) | |
tree | 4aeae6e22bf53888e2766ffb090182c541270dcb /activerecord/test/cases | |
parent | 7a69e27cdef97159464d76cf93a52f2ee16af010 (diff) | |
parent | f5c2bf10979a3e0d5f33665660c06423b967e4ec (diff) | |
download | rails-847395a04df52a389823ff4367c4b002cdbb5c6a.tar.gz rails-847395a04df52a389823ff4367c4b002cdbb5c6a.tar.bz2 rails-847395a04df52a389823ff4367c4b002cdbb5c6a.zip |
Merge pull request #18474 from notEthan/pretty_print_inspect
pretty_print will use #inspect if a subclass redefines it
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/core_test.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/activerecord/test/cases/core_test.rb b/activerecord/test/cases/core_test.rb index 715d92af99..3cb98832c5 100644 --- a/activerecord/test/cases/core_test.rb +++ b/activerecord/test/cases/core_test.rb @@ -98,4 +98,15 @@ class CoreTest < ActiveRecord::TestCase assert actual.start_with?(expected.split('XXXXXX').first) assert actual.end_with?(expected.split('XXXXXX').last) end + + def test_pretty_print_overridden_by_inspect + subtopic = Class.new(Topic) do + def inspect + "inspecting topic" + end + end + actual = '' + PP.pp(subtopic.new, StringIO.new(actual)) + assert_equal "inspecting topic\n", actual + end end |