diff options
author | jeem <jeem@hughesorama.com> | 2009-08-09 20:04:15 -0500 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2009-08-09 20:04:48 -0500 |
commit | e4ceea3795ecc7adcec28a1b9d63782be1401256 (patch) | |
tree | d340c2d7a279ba3667094183a114b8684edf6fae /activesupport/test | |
parent | ca92d44e7637ae6d28d6b88b67873d2795290cb5 (diff) | |
download | rails-e4ceea3795ecc7adcec28a1b9d63782be1401256.tar.gz rails-e4ceea3795ecc7adcec28a1b9d63782be1401256.tar.bz2 rails-e4ceea3795ecc7adcec28a1b9d63782be1401256.zip |
make private_and_public_methods unmemoizable [#2372 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/flush_cache_on_private_memoization_test.rb | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/activesupport/test/flush_cache_on_private_memoization_test.rb b/activesupport/test/flush_cache_on_private_memoization_test.rb new file mode 100644 index 0000000000..ddbd05b0e0 --- /dev/null +++ b/activesupport/test/flush_cache_on_private_memoization_test.rb @@ -0,0 +1,44 @@ +require 'rubygems' +require 'activesupport' +require 'test/unit' + +class FlashCacheOnPrivateMemoizationTest < Test::Unit::TestCase + extend ActiveSupport::Memoizable + + def test_public + assert_method_unmemoizable :pub + end + + def test_protected + assert_method_unmemoizable :prot + end + + def test_private + assert_method_unmemoizable :priv + end + + def pub; rand end + memoize :pub + + protected + + def prot; rand end + memoize :prot + + private + + def priv; rand end + memoize :priv + + def assert_method_unmemoizable(meth, message=nil) + full_message = build_message(message, "<?> not unmemoizable.\n", meth) + assert_block(full_message) do + a = send meth + b = send meth + unmemoize_all + c = send meth + a == b && a != c + end + end + +end
\ No newline at end of file |