aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/timestamp_test.rb
diff options
context:
space:
mode:
authorThiago Pinto <tapgyn@gmail.com>2014-03-19 21:13:03 -0400
committerThiago Pinto <tapgyn@gmail.com>2014-03-19 21:13:03 -0400
commitc80ca4c7803b4e8ed7f125ada9acc6b7c499af5f (patch)
treedc8c9fa419dc7f4a5fe7b320dab0c4126625c4c5 /activerecord/test/cases/timestamp_test.rb
parent8cea8ae278c0e0417e5d58a387cc5d31c0590251 (diff)
downloadrails-c80ca4c7803b4e8ed7f125ada9acc6b7c499af5f.tar.gz
rails-c80ca4c7803b4e8ed7f125ada9acc6b7c499af5f.tar.bz2
rails-c80ca4c7803b4e8ed7f125ada9acc6b7c499af5f.zip
ActiveRecord#touch should accept multiple attributes #14423
Diffstat (limited to 'activerecord/test/cases/timestamp_test.rb')
-rw-r--r--activerecord/test/cases/timestamp_test.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/activerecord/test/cases/timestamp_test.rb b/activerecord/test/cases/timestamp_test.rb
index 717e0e1866..5308fa8808 100644
--- a/activerecord/test/cases/timestamp_test.rb
+++ b/activerecord/test/cases/timestamp_test.rb
@@ -89,6 +89,18 @@ class TimestampTest < ActiveRecord::TestCase
assert_in_delta Time.now, task.ending, 1
end
+ def test_touching_many_attributes_updates_them
+ task = Task.first
+ previous_starting = task.starting
+ previous_ending = task.ending
+ task.touch(:starting, :ending)
+
+ assert_not_equal previous_starting, task.starting
+ assert_not_equal previous_ending, task.ending
+ assert_in_delta Time.now, task.starting, 1
+ assert_in_delta Time.now, task.ending, 1
+ end
+
def test_touching_a_record_without_timestamps_is_unexceptional
assert_nothing_raised { Car.first.touch }
end