aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2012-08-21 10:13:55 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2012-08-21 10:14:00 -0300
commit245fb737db0cdb6543d47eef4e72408bd90c966e (patch)
treedd286d1791f70d7d6f245531ade77101c528919d /activerecord/test
parent15e2b80a27c7fd48f1a3e22d1682281515b2c371 (diff)
parente9d2ad395ec2ef929d74752f3d71c80674044fbe (diff)
downloadrails-245fb737db0cdb6543d47eef4e72408bd90c966e.tar.gz
rails-245fb737db0cdb6543d47eef4e72408bd90c966e.tar.bz2
rails-245fb737db0cdb6543d47eef4e72408bd90c966e.zip
Merge pull request #6986 from kennyj/fix_6975
Fix #6975. Round usec when writing timestamp attribute.
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/dirty_test.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/activerecord/test/cases/dirty_test.rb b/activerecord/test/cases/dirty_test.rb
index 248f4efe3e..92677b9926 100644
--- a/activerecord/test/cases/dirty_test.rb
+++ b/activerecord/test/cases/dirty_test.rb
@@ -525,6 +525,21 @@ class DirtyTest < ActiveRecord::TestCase
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)
+ target.table_name = 'pirates'
+
+ created_on = Time.now
+
+ pirate = target.create(:created_on => created_on)
+ pirate.reload # Here mysql truncate the usec value to 0
+
+ pirate.created_on = created_on
+ assert !pirate.created_on_changed?
+ end
+ end
+
private
def with_partial_updates(klass, on = true)
old = klass.partial_updates?