From a2172e75f589f038ed10806e9a32be99d4d69f89 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 16 Oct 2007 16:36:52 +0000 Subject: Dispatcher: fix that to_prepare should only run once in production. Closes #9889. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7944 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/test/controller/dispatcher_test.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'actionpack/test/controller/dispatcher_test.rb') diff --git a/actionpack/test/controller/dispatcher_test.rb b/actionpack/test/controller/dispatcher_test.rb index 75b99c4d92..ec937ebfd2 100644 --- a/actionpack/test/controller/dispatcher_test.rb +++ b/actionpack/test/controller/dispatcher_test.rb @@ -96,6 +96,14 @@ class DispatcherTest < Test::Unit::TestCase assert_equal nil, b end + def test_to_prepare_only_runs_once_if_not_loading_dependencies + Dependencies.stubs(:load?).returns(false) + called = 0 + Dispatcher.to_prepare(:unprepared_test) { called += 1 } + 2.times { dispatch } + assert_equal 1, called + end + private def dispatch(output = @output) controller = mock -- cgit v1.2.3