Permalink
Browse files

Fixed that dispatcher preparation callbacks only run once in producti…

…on mode. Mock Routes.reload so that dispatcher preparation callback tests run. [Rick]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7033 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 1ddaec1 commit 9d4225f1298bebacc04cc0055b180c6b2926c024 @technoweenie technoweenie committed Jun 15, 2007
Showing with 10 additions and 2 deletions.
  1. +2 −0 railties/CHANGELOG
  2. +1 −2 railties/lib/dispatcher.rb
  3. +7 −0 railties/test/dispatcher_test.rb
View
@@ -1,5 +1,7 @@
*SVN*
+* Fixed that dispatcher preparation callbacks only run once in production mode. Mock Routes.reload so that dispatcher preparation callback tests run. [Rick]
+
* Fix syntax error in dispatcher than wrecked failsafe responses. #8625 [mtitorenko]
* Scaffolded validation errors set the appropriate HTTP status for XML responses. #6946, #8622 [Manfred Stienstra, mmmultiworks]
@@ -88,7 +88,6 @@ def to_prepare(identifier = nil, &block)
private
attr_accessor_with_default :preparation_callbacks, []
attr_accessor_with_default :preparation_callbacks_run, false
- alias_method :preparation_callbacks_run?, :preparation_callbacks_run
# CGI.new plus exception handling. CGI#read_multipart raises EOFError
# if body.empty? or body.size != Content-Length and raises ArgumentError
@@ -113,7 +112,7 @@ def reset_after_dispatch
end
def run_preparation_callbacks
- return if preparation_callbacks_run?
+ return if preparation_callbacks_run
preparation_callbacks.each { |_, callback| callback.call }
self.preparation_callbacks_run = true
end
@@ -27,11 +27,18 @@ def setup
Dispatcher.send(:preparation_callbacks_run=, false)
Object.const_set :ApplicationController, nil
+ class << ActionController::Routing::Routes
+ alias_method :old_reload, :reload
+ def reload() end
+ end
end
def teardown
Object.send :remove_const, :ApplicationController
ENV['REQUEST_METHOD'] = nil
+ class << ActionController::Routing::Routes
+ alias_method :reload, :old_reload
+ end
end
def test_ac_subclasses_cleared_on_reset

0 comments on commit 9d4225f

Please sign in to comment.