Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

root/branches/2-1-caching/railties/test/console_app_test.rb

Revision 7640, 0.7 kB (checked in by bitsweat, 1 year ago)

Move Railties' Dispatcher to ActionController::Dispatcher, introduce before_ and after_dispatch callbacks, and warm up to non-CGI requests.

Line 
1 require File.dirname(__FILE__) + '/abstract_unit'
2
3 require 'action_controller' # console_app uses 'action_controller/integration'
4
5 unless defined? ApplicationController
6   class ApplicationController < ActionController::Base; end
7 end
8
9 require 'dispatcher'
10 require 'console_app'
11
12 # console_app sets Test::Unit.run to work around the at_exit hook in test/unit, which kills IRB
13 Test::Unit.run = false
14
15 class ConsoleAppTest < Test::Unit::TestCase
16   def test_reload_should_fire_preparation_callbacks   
17     a = b = c = nil
18
19     Dispatcher.to_prepare { a = b = c = 1 }
20     Dispatcher.to_prepare { b = c = 2 }
21     Dispatcher.to_prepare { c = 3 }
22
23     reload!
24
25     assert_equal 1, a
26     assert_equal 2, b
27     assert_equal 3, c
28   end
29 end
Note: See TracBrowser for help on using the browser.