instiki/vendor/rails/activesupport/test/flush_cache_on_private_memoization_test.rb
Jacques Distler 4bdf703ab2 Instiki 0.17.2: Security Release
This release upgrades Instiki to Rails 2.3.4, which
patches two security holes in Rails. See

  http://weblog.rubyonrails.org/2009/9/4/ruby-on-rails-2-3-4

There are also some new features, and the usual boatload
of bugfixes. See the CHANGELOG for details.
2009-09-05 02:01:46 -05:00

44 lines
771 B
Ruby

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