diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2017-01-15 21:57:37 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-15 21:57:37 +0100 |
commit | a1575e5a1495e80cc270fe3459ca6da346a1e31e (patch) | |
tree | f0c6668b3d73eec50c0dedbe7490f7c57c842866 /activerecord | |
parent | a5632d84957139aa2d471703b22edc095b21ea78 (diff) | |
parent | afa2da6456c0e33c1c31dbbcee66f72fd8f32005 (diff) | |
download | rails-a1575e5a1495e80cc270fe3459ca6da346a1e31e.tar.gz rails-a1575e5a1495e80cc270fe3459ca6da346a1e31e.tar.bz2 rails-a1575e5a1495e80cc270fe3459ca6da346a1e31e.zip |
Merge pull request #27683 from eugeneius/update_counters_empty_touch_test
Add test for update_counters with empty touch array
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/test/cases/counter_cache_test.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/activerecord/test/cases/counter_cache_test.rb b/activerecord/test/cases/counter_cache_test.rb index c7d0ba32b4..46d7526cc0 100644 --- a/activerecord/test/cases/counter_cache_test.rb +++ b/activerecord/test/cases/counter_cache_test.rb @@ -221,6 +221,15 @@ class CounterCacheTest < ActiveRecord::TestCase assert_equal previously_updated_at, @topic.updated_at end + test "update counters doesn't touch timestamps with touch: []" do + @topic.update_column :updated_at, 5.minutes.ago + previously_updated_at = @topic.updated_at + + Topic.update_counters(@topic.id, replies_count: -1, touch: []) + + assert_equal previously_updated_at, @topic.updated_at + end + test "update counters with touch: true" do assert_touching @topic, :updated_at do Topic.update_counters(@topic.id, replies_count: -1, touch: true) |