Sha256: d92dd3f7cfc6aebfec7c09990a25a8b223e63ea4dd4aec71afc2216bf2dcfb83

Contents?: true

Size: 754 Bytes

Versions: 5

Compression:

Stored size: 754 Bytes

Contents

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

Version data entries

5 entries across 5 versions & 3 rubygems

Version Path
kajam-1.0.3.rc2 vendor/rails/activesupport/test/flush_cache_on_private_memoization_test.rb
radiant-1.0.0.rc2 vendor/rails/activesupport/test/flush_cache_on_private_memoization_test.rb
radiant-1.0.0.rc1 vendor/rails/activesupport/test/flush_cache_on_private_memoization_test.rb
radiant-0.9.0.rc2 vendor/rails/activesupport/test/flush_cache_on_private_memoization_test.rb
recliner-0.0.1 vendor/activesupport/test/flush_cache_on_private_memoization_test.rb