Permalink
Browse files

Change usec to 0 on tests that compare seconds

Avoid rounding problems with `.usec` method rounding the seconds when the
field doesn't persist the `.usec` piece.
  • Loading branch information...
1 parent 66d61ab commit 7058321725ba0054390a65d8f6343613df31eea9 @arthurnn arthurnn committed Mar 12, 2014
Showing with 3 additions and 3 deletions.
  1. +3 −3 activerecord/test/cases/persistence_test.rb
@@ -452,7 +452,7 @@ def test_update_attribute_with_one_updated
def test_update_attribute_for_updated_at_on
developer = Developer.find(1)
- prev_month = Time.now.prev_month
+ prev_month = Time.now.prev_month.change(usec: 0)
developer.update_attribute(:updated_at, prev_month)
assert_equal prev_month, developer.updated_at
@@ -523,7 +523,7 @@ def test_update_column_for_readonly_attribute
def test_update_column_should_not_modify_updated_at
developer = Developer.find(1)
- prev_month = Time.now.prev_month
+ prev_month = Time.now.prev_month.change(usec: 0)
developer.update_column(:updated_at, prev_month)
assert_equal prev_month, developer.updated_at
@@ -620,7 +620,7 @@ def test_update_columns_with_one_readonly_attribute
def test_update_columns_should_not_modify_updated_at
developer = Developer.find(1)
- prev_month = Time.now.prev_month
+ prev_month = Time.now.prev_month.change(usec: 0)
developer.update_columns(updated_at: prev_month)
assert_equal prev_month, developer.updated_at

0 comments on commit 7058321

Please sign in to comment.