Permalink
Browse files

make the cache test more @tenderlove(ing) and not depend on internal …

…implentation
  • Loading branch information...
1 parent 81b7112 commit 96f5ceaafb857722be16efcff7ece1a20baa76f0 @noahhendrix noahhendrix committed Oct 24, 2012
Showing with 7 additions and 2 deletions.
  1. +7 −2 activesupport/test/caching_test.rb
@@ -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

0 comments on commit 96f5cea

Please sign in to comment.