aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/memoizable_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/test/memoizable_test.rb')
-rw-r--r--activesupport/test/memoizable_test.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/activesupport/test/memoizable_test.rb b/activesupport/test/memoizable_test.rb
index 01631dc5e1..99d9240ea1 100644
--- a/activesupport/test/memoizable_test.rb
+++ b/activesupport/test/memoizable_test.rb
@@ -119,6 +119,21 @@ uses_mocha 'Memoizable' do
assert_equal 3, @calculator.counter
end
+ def test_unmemoize_all
+ assert_equal 1, @calculator.counter
+
+ assert @calculator.instance_variable_get(:@_memoized_counter).any?
+ @calculator.unmemoize_all
+ assert @calculator.instance_variable_get(:@_memoized_counter).empty?
+
+ assert_equal 2, @calculator.counter
+ end
+
+ def test_memoize_all
+ @calculator.memoize_all
+ assert @calculator.instance_variable_defined?(:@_memoized_counter)
+ end
+
def test_memoization_cache_is_different_for_each_instance
assert_equal 1, @calculator.counter
assert_equal 2, @calculator.counter(:reload)