Bug #16174

Feature #15958 triggers Rails unit test failure

Added by yahonda (Yasuo Honda) 11 months ago. Updated 11 months ago.

Third Party's Issue
Target version:
ruby -v:
ruby 2.7.0dev (2019-09-19T11:20:15Z 5208c431be 5208c431be) [x86_64-linux]


Let me inform one of Rails Active Record unit test get failed since
I prefer this change but let me inform because it may be one of incompatibility.

  • Steps to reproduce
git clone
cd rails/activerecord
bundle update --bundler
bundle install
bin/test test/cases/core_test.rb -n test_pretty_print_persisted
  • Expected output
    It should pass.

  • Actual result


CoreTest#test_pretty_print_persisted [/home/yahonda/git/rails/activerecord/test/cases/core_test.rb:96]:
Expected /\A#<Topic:0x\w+
 id: 1,
 title: "The First Topic",
 author_name: "David",
 author_email_address: "",
 written_on: 2003-07-16 14:28:11 UTC,
 bonus_time: 2000-01-01 14:28:00 UTC,
 last_read: Thu, 15 Apr 2004,
 content: "Have a nice day",
 important: nil,
 approved: false,
 replies_count: 1,
 unique_replies_count: 0,
 parent_id: nil,
 parent_title: nil,
 type: nil,
 group: nil,
 created_at: [^,]+,
 updated_at: [^,>]+>
\z/ to match "#<Topic:0x000055b4bc614268\n id: 1,\n title: \"The First Topic\",\n author_name: \"David\",\n author_email_address: \"\",\n written_on: 2003-07-16 14:28:11.2233 UTC,\n bonus_time: 2000-01-01 14:28:00 UTC,\n last_read: Thu, 15 Apr 2004,\n content: \"Have a nice day\",\n important: nil,\n approved: false,\n replies_count: 1,\n unique_replies_count: 0,\n parent_id: nil,\n parent_title: nil,\n type: nil,\n group: nil,\n created_at: 2019-09-21 03:47:55.972586 UTC,\n updated_at: 2019-09-21 03:47:55.972586 UTC>\n".

bin/test test/cases/core_test.rb:71

Finished in 0.020740s, 48.2163 runs/s, 96.4325 assertions/s.
1 runs, 2 assertions, 1 failures, 0 errors, 0 skips
  • Ruby version

  • Reproduced with:

    $ ruby -v
    ruby 2.7.0dev (2019-09-19T11:20:15Z 5208c431be 5208c431be) [x86_64-linux]
  • Not reproduced with

    $ ruby -v
    ruby 2.7.0dev (2019-09-19T10:40:44Z 2698f13 2698f13a1f) [x86_64-linux]

Updated by yahonda (Yasuo Honda) 11 months ago

  • ruby -v set to ruby 2.7.0dev (2019-09-19T11:20:15Z 5208c431be 5208c431be) [x86_64-linux]

This Rails unit test compares the output of Time using pp.
pp Time class object also changed to show subseconds.

  • Ruby 2.6.4
$ ruby -v
ruby 2.6.4p104 (2019-08-28 revision 67798) [x86_64-linux]
$ irb
irb(main):001:0> require 'time'
=> true
irb(main):002:0> t = Time.parse('2003-07-16t15:28:11.2233+01:00')
=> 2003-07-16 15:28:11 +0100
irb(main):003:0> pp t
2003-07-16 15:28:11 +0100
=> 2003-07-16 15:28:11 +0100
irb(main):004:0> quit
  • Ruby 2.7.0dev
$ ruby -v
ruby 2.7.0dev (2019-09-20T19:18:07Z master 27144de2bd) [x86_64-linux]
$ irb
irb(main):001:0> require 'time'
=> true
irb(main):002:0> t = Time.parse('2003-07-16t15:28:11.2233+01:00')
irb(main):003:0> pp t
2003-07-16 15:28:11.2233 +0100
=> 2003-07-16 15:28:11.2233 +0100
irb(main):004:0> quit

Updated by yahonda (Yasuo Honda) 11 months ago

Thanks for the fix. has been merged to master, I think this issue can be closed.


Updated by nobu (Nobuyoshi Nakada) 11 months ago

  • Status changed from Open to Third Party's Issue

Also available in: Atom PDF