diff options
author | Andrew White <andyw@pixeltrix.co.uk> | 2013-01-22 14:20:25 +0000 |
---|---|---|
committer | Andrew White <andyw@pixeltrix.co.uk> | 2013-01-22 14:20:25 +0000 |
commit | 7ee76714abe4775db4bc44b052338e732d38e93b (patch) | |
tree | 5e16b5ab638fd126da96d3a5437e30b4250a20ef | |
parent | 431759614d84395faa713ebdfa8bd1cadc97183a (diff) | |
download | rails-7ee76714abe4775db4bc44b052338e732d38e93b.tar.gz rails-7ee76714abe4775db4bc44b052338e732d38e93b.tar.bz2 rails-7ee76714abe4775db4bc44b052338e732d38e93b.zip |
Add failing test case for #8460
Add a test case to ensure that fractional second updates are detected.
-rw-r--r-- | activerecord/test/cases/dirty_test.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/activerecord/test/cases/dirty_test.rb b/activerecord/test/cases/dirty_test.rb index 86a28d95ad..a82ec6d3cd 100644 --- a/activerecord/test/cases/dirty_test.rb +++ b/activerecord/test/cases/dirty_test.rb @@ -549,6 +549,20 @@ class DirtyTest < ActiveRecord::TestCase 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) |