Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Refactor AR's counter_cache_test.rb test

  • Loading branch information...
commit 805bad746e0e484e2f6599f843e564f6fbd0f47b 1 parent 60c839c
Takehiro Adachi take authored
Showing with 3 additions and 8 deletions.
  1. +3 −8 activerecord/test/cases/counter_cache_test.rb
11 activerecord/test/cases/counter_cache_test.rb
View
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.