diff options
author | Michael Grosser <michael@grosser.it> | 2015-11-07 12:07:49 -0800 |
---|---|---|
committer | Michael Grosser <michael@grosser.it> | 2015-11-10 21:12:30 -0800 |
commit | a481f07817eb0ea3ea1e4dee07ce4fe7aa865bac (patch) | |
tree | 2cd23235e8e85cb9a471c5cb43d0996245afb0e3 /activesupport/test | |
parent | 5388464af6ec229ddf3a1040cd7466f45370cedd (diff) | |
download | rails-a481f07817eb0ea3ea1e4dee07ce4fe7aa865bac.tar.gz rails-a481f07817eb0ea3ea1e4dee07ce4fe7aa865bac.tar.bz2 rails-a481f07817eb0ea3ea1e4dee07ce4fe7aa865bac.zip |
send normalized keys to the cache backends so they do not need to manage this themselves
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/caching_test.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/activesupport/test/caching_test.rb b/activesupport/test/caching_test.rb index 3629f5e64b..3f9682231f 100644 --- a/activesupport/test/caching_test.rb +++ b/activesupport/test/caching_test.rb @@ -416,7 +416,7 @@ module CacheStoreBehavior def test_race_condition_protection_skipped_if_not_defined @cache.write('foo', 'bar') - time = @cache.send(:read_entry, 'foo', {}).expires_at + time = @cache.send(:read_entry, @cache.send(:normalize_key, 'foo', {}), {}).expires_at Time.stub(:now, Time.at(time)) do result = @cache.fetch('foo') do @@ -783,13 +783,13 @@ class FileStoreTest < ActiveSupport::TestCase end def test_key_transformation - key = @cache.send(:key_file_path, "views/index?id=1") + key = @cache.send(:normalize_key, "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") + key = @cache_with_pathname.send(:normalize_key, "views/index?id=1", {}) assert_equal "views/index?id=1", @cache_with_pathname.send(:file_path_key, key) end @@ -797,7 +797,7 @@ class FileStoreTest < ActiveSupport::TestCase # remain valid def test_filename_max_size key = "#{'A' * ActiveSupport::Cache::FileStore::FILENAME_MAX_SIZE}" - path = @cache.send(:key_file_path, key) + path = @cache.send(:normalize_key, key, {}) Dir::Tmpname.create(path) do |tmpname, n, opts| assert File.basename(tmpname+'.lock').length <= 255, "Temp filename too long: #{File.basename(tmpname+'.lock').length}" end @@ -807,7 +807,7 @@ class FileStoreTest < ActiveSupport::TestCase # If filename is 'AAAAB', where max size is 4, the returned path should be AAAA/B def test_key_transformation_max_filename_size key = "#{'A' * ActiveSupport::Cache::FileStore::FILENAME_MAX_SIZE}B" - path = @cache.send(:key_file_path, key) + path = @cache.send(:normalize_key, key, {}) assert path.split('/').all? { |dir_name| dir_name.size <= ActiveSupport::Cache::FileStore::FILENAME_MAX_SIZE} assert_equal 'B', File.basename(path) end |