Skip to content
Browse files

Add failing test: ActiveSupport::Cache::FileStore#file_path_key does …

…not work if initialized with Pathname
  • Loading branch information...
1 parent 0988da6 commit 353479167af47ebe824c5599bcd8185fc2894a91 Sam Umbach, Zachary Porter and Michael Pell committed Jul 23, 2011
Showing with 7 additions and 0 deletions.
  1. +7 −0 activesupport/test/caching_test.rb
View
7 activesupport/test/caching_test.rb
@@ -516,6 +516,7 @@ def setup
Dir.mkdir(cache_dir) unless File.exist?(cache_dir)
@cache = ActiveSupport::Cache.lookup_store(:file_store, cache_dir, :expires_in => 60)
@peek = ActiveSupport::Cache.lookup_store(:file_store, cache_dir, :expires_in => 60)
+ @cache_with_pathname = ActiveSupport::Cache.lookup_store(:file_store, Pathname.new(cache_dir), :expires_in => 60)
end
def teardown
@@ -555,6 +556,12 @@ def test_key_transformation
key = @cache.send(:key_file_path, "views/index?id=1")
assert_equal "views/index?id=1", @cache.send(:file_path_key, key)
end
+
+ def test_key_transformation_with_pathname
+ FileUtils.touch(File.join(cache_dir, "foo"))
+ key = @cache_with_pathname.send(:key_file_path, "views/index?id=1")
+ assert_equal "views/index?id=1", @cache_with_pathname.send(:file_path_key, key)
+ end
end
class MemoryStoreTest < ActiveSupport::TestCase

0 comments on commit 3534791

Please sign in to comment.
Something went wrong with that request. Please try again.