diff options
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/caching_test.rb | 16 | ||||
-rw-r--r-- | activesupport/test/core_ext/module/model_naming_test.rb | 28 |
2 files changed, 16 insertions, 28 deletions
diff --git a/activesupport/test/caching_test.rb b/activesupport/test/caching_test.rb index 51d04d9388..c2a03818e1 100644 --- a/activesupport/test/caching_test.rb +++ b/activesupport/test/caching_test.rb @@ -146,6 +146,22 @@ class FileStoreTest < ActiveSupport::TestCase end include CacheStoreBehavior + + def test_expires_in + time = Time.local(2008, 4, 24) + Time.stubs(:now).returns(time) + File.stubs(:mtime).returns(time) + + @cache.write('foo', 'bar') + cache_read = lambda { @cache.read('foo', :expires_in => 1.minute) } + assert_equal 'bar', cache_read.call + + Time.stubs(:now).returns(time + 30.seconds) + assert_equal 'bar', cache_read.call + + Time.stubs(:now).returns(time + 2.minutes) + assert_nil cache_read.call + end end class MemoryStoreTest < ActiveSupport::TestCase diff --git a/activesupport/test/core_ext/module/model_naming_test.rb b/activesupport/test/core_ext/module/model_naming_test.rb deleted file mode 100644 index 37119f378a..0000000000 --- a/activesupport/test/core_ext/module/model_naming_test.rb +++ /dev/null @@ -1,28 +0,0 @@ -require 'abstract_unit' -require 'active_support/core_ext/module/model_naming' - -class ModelNamingTest < Test::Unit::TestCase - def setup - @model_name = ActiveSupport::ModelName.new('Post::TrackBack') - end - - def test_singular - assert_equal 'post_track_back', @model_name.singular - end - - def test_plural - assert_equal 'post_track_backs', @model_name.plural - end - - def test_element - assert_equal 'track_back', @model_name.element - end - - def test_collection - assert_equal 'post/track_backs', @model_name.collection - end - - def test_partial_path - assert_equal 'post/track_backs/track_back', @model_name.partial_path - end -end |