diff options
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/dispatch/middleware_stack/middleware_test.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/middleware_stack/middleware_test.rb b/actionpack/test/dispatch/middleware_stack/middleware_test.rb index 4e16fdbc77..9607f026db 100644 --- a/actionpack/test/dispatch/middleware_stack/middleware_test.rb +++ b/actionpack/test/dispatch/middleware_stack/middleware_test.rb @@ -47,6 +47,31 @@ module ActionDispatch mw = Middleware.new Omg assert_operator mw, :==, "::#{Omg.name}" end + + def test_middleware_loads_classnames_from_cache + mw = Class.new(Middleware) { + attr_accessor :classcache + }.new(Omg.name) + + fake_cache = { mw.name => Omg } + mw.classcache = fake_cache + + assert_equal Omg, mw.klass + + fake_cache[mw.name] = Middleware + assert_equal Middleware, mw.klass + end + + def test_middleware_always_returns_class + mw = Class.new(Middleware) { + attr_accessor :classcache + }.new(Omg) + + fake_cache = { mw.name => Middleware } + mw.classcache = fake_cache + + assert_equal Omg, mw.klass + end end end end |