1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activesupport/test/flush_cache_on_private_memoization_test.rb
Santiago Pastorino and Sebastian Martinez 1e2caa5d52 Added missing requires abstract_unit and activesupport to the loadpath of ts_isolated [#4215 state:committed]
Signed-off-by: wycats <wycats@gmail.com>
2010-03-18 17:50:28 -07:00

44 lines
778 B
Ruby

require 'abstract_unit'
require 'active_support'
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