diff options
author | Emilio Tagua <miloops@gmail.com> | 2009-09-22 15:08:45 -0300 |
---|---|---|
committer | Emilio Tagua <miloops@gmail.com> | 2009-09-22 15:08:45 -0300 |
commit | 5f9540e4830ace3459b4018006573bad7fb30b53 (patch) | |
tree | d8bdf97e712fec925bf6fe5ddccf4a7e9683c7a0 /actionpack/test/controller/dispatcher_test.rb | |
parent | a294d8362bfb62b7133ad0799ae1327cd5ddd1e4 (diff) | |
parent | 24074796031d76d3ac2f5f0078d75699cce1bc54 (diff) | |
download | rails-5f9540e4830ace3459b4018006573bad7fb30b53.tar.gz rails-5f9540e4830ace3459b4018006573bad7fb30b53.tar.bz2 rails-5f9540e4830ace3459b4018006573bad7fb30b53.zip |
Merge commit 'rails/master'
Diffstat (limited to 'actionpack/test/controller/dispatcher_test.rb')
-rw-r--r-- | actionpack/test/controller/dispatcher_test.rb | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/actionpack/test/controller/dispatcher_test.rb b/actionpack/test/controller/dispatcher_test.rb index 9fae1fcf63..150fc83cde 100644 --- a/actionpack/test/controller/dispatcher_test.rb +++ b/actionpack/test/controller/dispatcher_test.rb @@ -3,13 +3,16 @@ require 'abstract_unit' class DispatcherTest < Test::Unit::TestCase Dispatcher = ActionController::Dispatcher + class Foo + cattr_accessor :a, :b + end + def setup ENV['REQUEST_METHOD'] = 'GET' # Clear callbacks as they are redefined by Dispatcher#define_dispatcher_callbacks - ActionDispatch::Callbacks.instance_variable_set("@prepare_callbacks", ActiveSupport::Callbacks::CallbackChain.new) - ActionDispatch::Callbacks.instance_variable_set("@before_callbacks", ActiveSupport::Callbacks::CallbackChain.new) - ActionDispatch::Callbacks.instance_variable_set("@after_callbacks", ActiveSupport::Callbacks::CallbackChain.new) + ActionDispatch::Callbacks.reset_callbacks(:prepare) + ActionDispatch::Callbacks.reset_callbacks(:call) @old_router, Dispatcher.router = Dispatcher.router, mock() Dispatcher.router.stubs(:call).returns([200, {}, 'response']) @@ -68,13 +71,12 @@ class DispatcherTest < Test::Unit::TestCase end def test_to_prepare_with_identifier_replaces - a = b = nil - Dispatcher.to_prepare(:unique_id) { |*args| a = b = 1 } - Dispatcher.to_prepare(:unique_id) { |*args| a = 2 } + Dispatcher.to_prepare(:unique_id) { |*args| Foo.a, Foo.b = 1, 1 } + Dispatcher.to_prepare(:unique_id) { |*args| Foo.a = 2 } dispatch - assert_equal 2, a - assert_equal nil, b + assert_equal 2, Foo.a + assert_equal nil, Foo.b end private |