diff options
author | Takehiro Adachi <takehiro0740@gmail.com> | 2013-05-23 01:25:15 +0900 |
---|---|---|
committer | Takehiro Adachi <takehiro0740@gmail.com> | 2013-05-23 01:28:04 +0900 |
commit | 805bad746e0e484e2f6599f843e564f6fbd0f47b (patch) | |
tree | f36629611b50174104c31095ab9fc28085d42baf /activerecord | |
parent | 60c839cb1a5ab890397eebac252a5928c1166238 (diff) | |
download | rails-805bad746e0e484e2f6599f843e564f6fbd0f47b.tar.gz rails-805bad746e0e484e2f6599f843e564f6fbd0f47b.tar.bz2 rails-805bad746e0e484e2f6599f843e564f6fbd0f47b.zip |
Refactor AR's counter_cache_test.rb test
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/test/cases/counter_cache_test.rb | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/activerecord/test/cases/counter_cache_test.rb b/activerecord/test/cases/counter_cache_test.rb index b19966765e..ee3d8a81c2 100644 --- a/activerecord/test/cases/counter_cache_test.rb +++ b/activerecord/test/cases/counter_cache_test.rb @@ -51,14 +51,9 @@ class CounterCacheTest < ActiveRecord::TestCase end end - test 'reset multiple association counters' do - Topic.increment_counter(:replies_count, @topic.id) - assert_difference '@topic.reload.replies_count', -1 do - Topic.reset_counters(@topic.id, :replies, :unique_replies) - end - - Topic.increment_counter(:unique_replies_count, @topic.id) - assert_difference '@topic.reload.unique_replies_count', -1 do + test 'reset multiple counters' do + Topic.update_counters @topic.id, replies_count: 1, unique_replies_count: 1 + assert_difference ['@topic.reload.replies_count', '@topic.reload.unique_replies_count'], -1 do Topic.reset_counters(@topic.id, :replies, :unique_replies) end end |