aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/timestamp_test.rb
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2018-03-23 10:05:54 +0900
committerRyuta Kamizono <kamipo@gmail.com>2018-03-23 10:05:54 +0900
commit6aa5cf03ea8232180ffbbae4c130b051f813c670 (patch)
tree29f6062d0288857e267aaf22af157f6963912a68 /activerecord/test/cases/timestamp_test.rb
parent57e145387ba57602afb0907f2a3897d37089dc4e (diff)
downloadrails-6aa5cf03ea8232180ffbbae4c130b051f813c670.tar.gz
rails-6aa5cf03ea8232180ffbbae4c130b051f813c670.tar.bz2
rails-6aa5cf03ea8232180ffbbae4c130b051f813c670.zip
Fix that `touch(:updated_at)` causes multiple assignments on the column
The multiple assignments was caused by 37a1dfa due to lost the `to_s` normalization for given names. Fixes #32323.
Diffstat (limited to 'activerecord/test/cases/timestamp_test.rb')
-rw-r--r--activerecord/test/cases/timestamp_test.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/activerecord/test/cases/timestamp_test.rb b/activerecord/test/cases/timestamp_test.rb
index e95446c0a7..d9f7a81ce4 100644
--- a/activerecord/test/cases/timestamp_test.rb
+++ b/activerecord/test/cases/timestamp_test.rb
@@ -96,6 +96,16 @@ class TimestampTest < ActiveRecord::TestCase
assert_not_equal @previously_updated_at, @developer.updated_at
end
+ def test_touching_update_at_attribute_as_symbol_updates_timestamp
+ travel(1.second) do
+ @developer.touch(:updated_at)
+ end
+
+ assert_not @developer.updated_at_changed?
+ assert_not @developer.changed?
+ assert_not_equal @previously_updated_at, @developer.updated_at
+ end
+
def test_touching_an_attribute_updates_it
task = Task.first
previous_value = task.ending