Browse files

Refactor AR's counter_cache_test.rb test

  • Loading branch information...
1 parent 60c839c commit 805bad746e0e484e2f6599f843e564f6fbd0f47b @take take committed May 22, 2013
Showing with 3 additions and 8 deletions.
  1. +3 −8 activerecord/test/cases/counter_cache_test.rb
View
11 activerecord/test/cases/counter_cache_test.rb
@@ -51,14 +51,9 @@ class ::SpecialReply < ::Reply
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

0 comments on commit 805bad7

Please sign in to comment.