aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/memoizable_test.rb
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2008-12-03 10:57:08 -0600
committerJoshua Peek <josh@joshpeek.com>2008-12-03 10:57:35 -0600
commit761a633a9c0a45d76ef3ed10da97e3696c3ded79 (patch)
tree1e3d752fed55939340900eb6d76f83518f10e2b5 /activesupport/test/memoizable_test.rb
parent2fc6c7dd05b9481ed81fe19c8fc0cc7915868404 (diff)
downloadrails-761a633a9c0a45d76ef3ed10da97e3696c3ded79.tar.gz
rails-761a633a9c0a45d76ef3ed10da97e3696c3ded79.tar.bz2
rails-761a633a9c0a45d76ef3ed10da97e3696c3ded79.zip
Add Memoizable#flush_cache to clear the cache of a specific method [#1505 state:resolved]
Diffstat (limited to 'activesupport/test/memoizable_test.rb')
-rw-r--r--activesupport/test/memoizable_test.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/activesupport/test/memoizable_test.rb b/activesupport/test/memoizable_test.rb
index 33f1e7fe61..069ae27eb2 100644
--- a/activesupport/test/memoizable_test.rb
+++ b/activesupport/test/memoizable_test.rb
@@ -128,6 +128,16 @@ class MemoizableTest < Test::Unit::TestCase
assert_equal 3, @calculator.counter
end
+ def test_flush_cache
+ assert_equal 1, @calculator.counter
+
+ assert @calculator.instance_variable_get(:@_memoized_counter).any?
+ @calculator.flush_cache(:counter)
+ assert @calculator.instance_variable_get(:@_memoized_counter).empty?
+
+ assert_equal 2, @calculator.counter
+ end
+
def test_unmemoize_all
assert_equal 1, @calculator.counter