diff options
author | Mike Breen <hardbap@gmail.com> | 2009-05-20 10:31:12 -0400 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2009-12-02 12:20:00 -0800 |
commit | 50c28e78c7aa40dc329facbe6131d657d5629bd4 (patch) | |
tree | 85892682a5ef70729f11ec5742d25634f4f56351 /activerecord/test/cases/base_test.rb | |
parent | de2cd8e39f68d874b833b3a4860769c4edc57cbe (diff) | |
download | rails-50c28e78c7aa40dc329facbe6131d657d5629bd4.tar.gz rails-50c28e78c7aa40dc329facbe6131d657d5629bd4.tar.bz2 rails-50c28e78c7aa40dc329facbe6131d657d5629bd4.zip |
Implement ActiveRecord#reset_counter_cache
[#1211 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
Diffstat (limited to 'activerecord/test/cases/base_test.rb')
-rwxr-xr-x | activerecord/test/cases/base_test.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb index 5c2911eca1..737ca01d46 100755 --- a/activerecord/test/cases/base_test.rb +++ b/activerecord/test/cases/base_test.rb @@ -680,6 +680,16 @@ class BasicsTest < ActiveRecord::TestCase assert_equal -2, Topic.find(2).replies_count end + def test_reset_counter_cache + assert_equal 1, Topic.find(1).replies_count + + Topic.increment_counter("replies_count", 1) + assert_equal 2, Topic.find(1).replies_count + + Topic.reset_counter_cache(:replies) + assert_equal 1, Topic.find(1).replies_count + end + def test_update_counter category = categories(:general) assert_nil category.categorizations_count |