diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2015-11-16 18:12:19 -0200 |
---|---|---|
committer | Rafael França <rafaelmfranca@gmail.com> | 2015-11-16 18:12:19 -0200 |
commit | b58c37e051d7a77368a440f7f5351da04dee2336 (patch) | |
tree | f1b6acb01a05c8f30630f13895795fd39fb2b720 /activesupport/test | |
parent | bde974f418e2de7095fd6fd19c1e72b0c749fc30 (diff) | |
parent | f6bc5acf1006ef4c6cac03aee4b76d62e54465d4 (diff) | |
download | rails-b58c37e051d7a77368a440f7f5351da04dee2336.tar.gz rails-b58c37e051d7a77368a440f7f5351da04dee2336.tar.bz2 rails-b58c37e051d7a77368a440f7f5351da04dee2336.zip |
Merge pull request #22215 from grosser/grosser/normalize_key
send normalized keys to the cache backends so they do not need to man…
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 |