Permalink
Browse files

Add failing test case for #8460

Add a test case to ensure that fractional second updates are detected.
  • Loading branch information...
1 parent 4317596 commit 7ee76714abe4775db4bc44b052338e732d38e93b @pixeltrix pixeltrix committed Jan 22, 2013
Showing with 14 additions and 0 deletions.
  1. +14 −0 activerecord/test/cases/dirty_test.rb
@@ -549,6 +549,20 @@ def test_field_named_field
end
end
+ def test_datetime_attribute_can_be_updated_with_fractional_seconds
+ in_time_zone 'Paris' do
+ target = Class.new(ActiveRecord::Base)
+ target.table_name = 'topics'
+
+ written_on = Time.utc(2012, 12, 1, 12, 0, 0).in_time_zone('Paris')
+
+ topic = target.create(:written_on => written_on)
+ topic.written_on += 0.3
+
+ assert topic.written_on_changed?, 'Fractional second update not detected'
+ end
+ end
+
def test_setting_time_attributes_with_time_zone_field_to_same_time_should_not_be_marked_as_a_change
in_time_zone 'Paris' do
target = Class.new(ActiveRecord::Base)

0 comments on commit 7ee7671

Please sign in to comment.