Skip to content

Commit

Permalink
Change usec to 0 on tests that compare seconds
Browse files Browse the repository at this point in the history
Avoid rounding problems with `.usec` method rounding the seconds when the
field doesn't persist the `.usec` piece.
  • Loading branch information
arthurnn committed Mar 12, 2014
1 parent 66d61ab commit 7058321
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions activerecord/test/cases/persistence_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 7058321

Please sign in to comment.