diff options
author | Thijs de Vries <thijs@thijs-de-vriess-macbook.local> | 2009-01-31 18:31:59 -0500 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2009-02-05 20:59:05 +0100 |
commit | be1dbf321aba03c2e9bec423f753308e9bba3ef5 (patch) | |
tree | ee8a3fd26b3802cdf399c1c48e891d459ccc19af /activesupport/test | |
parent | 250dfb18afb58dda3caf4b9f170ddb9c5cf85faf (diff) | |
download | rails-be1dbf321aba03c2e9bec423f753308e9bba3ef5.tar.gz rails-be1dbf321aba03c2e9bec423f753308e9bba3ef5.tar.bz2 rails-be1dbf321aba03c2e9bec423f753308e9bba3ef5.zip |
created unit tests and fixed bug that failed tests
Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/caching_test.rb | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/activesupport/test/caching_test.rb b/activesupport/test/caching_test.rb index 4e212f1661..e5105e92a2 100644 --- a/activesupport/test/caching_test.rb +++ b/activesupport/test/caching_test.rb @@ -90,7 +90,27 @@ module CacheStoreBehavior @cache.write('foo', nil) assert_equal nil, @cache.read('foo') end - + + def test_should_read_and_write_false + @cache.write('foo', false) + assert_equal false, @cache.read('foo') + end + + def test_should_read_and_write_true + @cache.write('foo', true) + assert_equal true, @cache.read('foo') + end + + def test_fetch_false_without_cache_miss + @cache.write('foo', false) + assert_equal false, @cache.fetch('foo') { 'baz' } + end + + def test_fetch_nil_without_cache_miss + @cache.write('foo', nil) + assert_equal nil, @cache.fetch('foo') { 'baz' } + end + def test_fetch_without_cache_miss @cache.write('foo', 'bar') assert_equal 'bar', @cache.fetch('foo') { 'baz' } |