diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-03-02 10:11:28 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-03-02 10:11:28 -0800 |
commit | 1f2e7214aaed01f50be12017f0ffbf9fcdbdbb5e (patch) | |
tree | 8c2e018812b254493998e37eb03c8e4a710369c0 /actionpack/test | |
parent | 91983724211b0e654c9e79e73bacf10a65adf172 (diff) | |
download | rails-1f2e7214aaed01f50be12017f0ffbf9fcdbdbb5e.tar.gz rails-1f2e7214aaed01f50be12017f0ffbf9fcdbdbb5e.tar.bz2 rails-1f2e7214aaed01f50be12017f0ffbf9fcdbdbb5e.zip |
make sure string keys are always looked up from the class cache
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 |