diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-03-02 00:10:06 -0300 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-03-13 20:08:54 -0300 |
commit | a8dd21d8b459ce4d57160a359798c577085a95e9 (patch) | |
tree | 3c6a7537d06cbc35200edc13ac9d7cf03238025e /activerecord/test/cases/identity_map/middleware_test.rb | |
parent | c1f397f82c7b3f352500832a399b5dbdc500b9c8 (diff) | |
download | rails-a8dd21d8b459ce4d57160a359798c577085a95e9.tar.gz rails-a8dd21d8b459ce4d57160a359798c577085a95e9.tar.bz2 rails-a8dd21d8b459ce4d57160a359798c577085a95e9.zip |
Remove IdentityMap
Diffstat (limited to 'activerecord/test/cases/identity_map/middleware_test.rb')
-rw-r--r-- | activerecord/test/cases/identity_map/middleware_test.rb | 74 |
1 files changed, 0 insertions, 74 deletions
diff --git a/activerecord/test/cases/identity_map/middleware_test.rb b/activerecord/test/cases/identity_map/middleware_test.rb deleted file mode 100644 index 5b32a1c6d2..0000000000 --- a/activerecord/test/cases/identity_map/middleware_test.rb +++ /dev/null @@ -1,74 +0,0 @@ -require "cases/helper" -require "rack" - -module ActiveRecord - module IdentityMap - class MiddlewareTest < ActiveRecord::TestCase - def setup - super - @enabled = IdentityMap.enabled - IdentityMap.enabled = false - end - - def teardown - super - IdentityMap.enabled = @enabled - IdentityMap.clear - end - - def test_delegates - called = false - mw = Middleware.new lambda { |env| - called = true - [200, {}, nil] - } - mw.call({}) - assert called, 'middleware delegated' - end - - def test_im_enabled_during_delegation - mw = Middleware.new lambda { |env| - assert IdentityMap.enabled?, 'identity map should be enabled' - [200, {}, nil] - } - mw.call({}) - end - - class Enum < Struct.new(:iter) - def each(&b) - iter.call(&b) - end - end - - def test_im_enabled_during_body_each - mw = Middleware.new lambda { |env| - [200, {}, Enum.new(lambda { |&b| - assert IdentityMap.enabled?, 'identity map should be enabled' - b.call "hello" - })] - } - body = mw.call({}).last - body.each { |x| assert_equal 'hello', x } - end - - def test_im_disabled_after_body_close - mw = Middleware.new lambda { |env| [200, {}, []] } - body = mw.call({}).last - assert IdentityMap.enabled?, 'identity map should be enabled' - body.close - 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 |