Skip to content

Commit

Permalink
make the cache test more @tenderlove(ing) and not depend on internal …
Browse files Browse the repository at this point in the history
…implentation
  • Loading branch information
noahhendrix committed Oct 24, 2012
1 parent 81b7112 commit 96f5cea
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions activesupport/test/caching_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,13 @@ def test_fetch_with_cache_miss
end

def test_fetch_with_cache_miss_passes_key_to_block
@cache.expects(:write).with('foo', 3, @cache.options)
assert_equal 3, @cache.fetch('foo') { |key| key.length }
cache_miss = false
assert_equal 3, @cache.fetch('foo') { |key| cache_miss = true; key.length }
assert cache_miss

cache_miss = false
assert_equal 3, @cache.fetch('foo') { |key| cache_miss = true; key.length }
assert !cache_miss
end

def test_fetch_with_forced_cache_miss
Expand Down

0 comments on commit 96f5cea

Please sign in to comment.