Project

General

Profile

Actions

Bug #16174

closed

Feature #15958 triggers Rails unit test failure

Added by yahonda (Yasuo Honda) over 4 years ago. Updated over 4 years ago.

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

Description

Let me inform one of Rails Active Record unit test get failed since https://bugs.ruby-lang.org/issues/15958
I prefer this change but let me inform because it may be one of incompatibility.

  • Steps to reproduce
git clone https://github.com/rails/rails.git
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

F

Failure:
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: "david@loudthinking.com",
 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: \"david@loudthinking.com\",\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) over 4 years 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) over 4 years ago

Thanks for the fix. https://github.com/rails/rails/pull/37262 has been merged to master, I think this issue can be closed.

Actions #4

Updated by nobu (Nobuyoshi Nakada) over 4 years ago

  • Status changed from Open to Third Party's Issue
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0