diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-05-03 09:32:15 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-05-03 09:59:21 -0700 |
commit | 3f897c1a4cef0cb9b53234e10d10d4b8744d61b0 (patch) | |
tree | b24fd9fc994774f2bbd2004107bcb12278db0ed0 /activerecord/test/cases/identity_map/middleware_test.rb | |
parent | af8c54be0a88af7e8227f156257236a10da7ffbe (diff) | |
download | rails-3f897c1a4cef0cb9b53234e10d10d4b8744d61b0.tar.gz rails-3f897c1a4cef0cb9b53234e10d10d4b8744d61b0.tar.bz2 rails-3f897c1a4cef0cb9b53234e10d10d4b8744d61b0.zip |
adding a test case for the identity map middleware
Diffstat (limited to 'activerecord/test/cases/identity_map/middleware_test.rb')
-rw-r--r-- | activerecord/test/cases/identity_map/middleware_test.rb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/activerecord/test/cases/identity_map/middleware_test.rb b/activerecord/test/cases/identity_map/middleware_test.rb new file mode 100644 index 0000000000..1004e958e5 --- /dev/null +++ b/activerecord/test/cases/identity_map/middleware_test.rb @@ -0,0 +1,34 @@ +require "cases/helper" + +module ActiveRecord + module IdentityMap + class MiddlewareTest < ActiveRecord::TestCase + def setup + super + @enabled = IdentityMap.enabled + IdentityMap.enabled = false + end + + def teardown + super + IdentityMap.enabled = @enabled + end + + def test_delegates + called = false + mw = Middleware.new lambda { |env| + called = true + } + 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' + } + mw.call({}) + end + end + end +end |