aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2016-07-20 00:52:55 -0300
committerGitHub <noreply@github.com>2016-07-20 00:52:55 -0300
commit8a0b3ca8c4f0c3ae95b3a275f0f881092466e964 (patch)
tree04e7f4a49a1736ea93010cc42d1952ed038f4ae0
parentb72674098b254a2497dafd3cf1c6a641ddc5257b (diff)
parent2d78a3ae86f9f825f90a72de2693c567ecb5c4bd (diff)
downloadrails-8a0b3ca8c4f0c3ae95b3a275f0f881092466e964.tar.gz
rails-8a0b3ca8c4f0c3ae95b3a275f0f881092466e964.tar.bz2
rails-8a0b3ca8c4f0c3ae95b3a275f0f881092466e964.zip
Merge pull request #25822 from mechanicles/clear-local-cache-on-invalid-parameters-error
Add missing test for clearing up local cache on invalid parameters error.
-rw-r--r--activesupport/test/caching_test.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/activesupport/test/caching_test.rb b/activesupport/test/caching_test.rb
index 8002c14539..1e3810f6f7 100644
--- a/activesupport/test/caching_test.rb
+++ b/activesupport/test/caching_test.rb
@@ -25,6 +25,18 @@ module ActiveSupport
assert_nil LocalCacheRegistry.cache_for(key)
end
+ def test_local_cache_cleared_and_response_should_be_present_on_invalid_parameters_error
+ key = "super awesome key"
+ assert_nil LocalCacheRegistry.cache_for key
+ middleware = Middleware.new('<3', key).new(->(env) {
+ assert LocalCacheRegistry.cache_for(key), 'should have a cache'
+ raise Rack::Utils::InvalidParameterError
+ })
+ response = middleware.call({})
+ assert response, 'response should exist'
+ assert_nil LocalCacheRegistry.cache_for(key)
+ end
+
def test_local_cache_cleared_on_exception
key = "super awesome key"
assert_nil LocalCacheRegistry.cache_for key