aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorNoah Hendrix <noahhendrix@gmail.com>2012-10-23 18:42:37 -0700
committerNoah Hendrix <noahhendrix@gmail.com>2012-10-23 18:42:37 -0700
commit96f5ceaafb857722be16efcff7ece1a20baa76f0 (patch)
tree4e69e71b772bd9a07b4e71dfb05630e6440ee531 /activesupport
parent81b711256591874b92683e55dc405286eb6df7a6 (diff)
downloadrails-96f5ceaafb857722be16efcff7ece1a20baa76f0.tar.gz
rails-96f5ceaafb857722be16efcff7ece1a20baa76f0.tar.bz2
rails-96f5ceaafb857722be16efcff7ece1a20baa76f0.zip
make the cache test more @tenderlove(ing) and not depend on internal implentation
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/test/caching_test.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/activesupport/test/caching_test.rb b/activesupport/test/caching_test.rb
index 318d51767d..ed903746c8 100644
--- a/activesupport/test/caching_test.rb
+++ b/activesupport/test/caching_test.rb
@@ -198,8 +198,13 @@ module CacheStoreBehavior
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