diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-05-03 09:57:39 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-05-03 09:59:22 -0700 |
commit | cb9557c432599657a8a2c1a1df50f35113c94305 (patch) | |
tree | 41b586746738431c771a5e599badd2434e311152 /activerecord/test/cases/identity_map | |
parent | d0719c59384c387aebfdc4a78f6e985bcf5bb270 (diff) | |
download | rails-cb9557c432599657a8a2c1a1df50f35113c94305.tar.gz rails-cb9557c432599657a8a2c1a1df50f35113c94305.tar.bz2 rails-cb9557c432599657a8a2c1a1df50f35113c94305.zip |
make sure IM repository is cleared after body is closed
Diffstat (limited to 'activerecord/test/cases/identity_map')
-rw-r--r-- | activerecord/test/cases/identity_map/middleware_test.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/activerecord/test/cases/identity_map/middleware_test.rb b/activerecord/test/cases/identity_map/middleware_test.rb index 130f370da6..60dcad4586 100644 --- a/activerecord/test/cases/identity_map/middleware_test.rb +++ b/activerecord/test/cases/identity_map/middleware_test.rb @@ -12,6 +12,7 @@ module ActiveRecord def teardown super IdentityMap.enabled = @enabled + IdentityMap.clear end def test_delegates @@ -55,6 +56,16 @@ module ActiveRecord assert !IdentityMap.enabled?, 'identity map should be disabled' end + def test_im_cleared_after_body_close + mw = Middleware.new lambda { |env| [200, {}, []] } + body = mw.call({}).last + + IdentityMap.repository['hello'] = 'world' + assert !IdentityMap.repository.empty?, 'repo should not be empty' + + body.close + assert IdentityMap.repository.empty?, 'repo should be empty' + end end end end |