2008-05-18 06:22:34 +02:00
|
|
|
require 'abstract_unit'
|
2007-12-21 08:48:59 +01:00
|
|
|
|
|
|
|
require 'action_controller' # console_app uses 'action_controller/integration'
|
|
|
|
|
|
|
|
unless defined? ApplicationController
|
|
|
|
class ApplicationController < ActionController::Base; end
|
|
|
|
end
|
|
|
|
|
|
|
|
require 'dispatcher'
|
|
|
|
require 'console_app'
|
|
|
|
|
|
|
|
# console_app sets Test::Unit.run to work around the at_exit hook in test/unit, which kills IRB
|
|
|
|
Test::Unit.run = false
|
|
|
|
|
|
|
|
class ConsoleAppTest < Test::Unit::TestCase
|
2008-05-18 06:22:34 +02:00
|
|
|
uses_mocha 'console reload test' do
|
|
|
|
def test_reload_should_fire_preparation_callbacks
|
|
|
|
a = b = c = nil
|
2007-12-21 08:48:59 +01:00
|
|
|
|
2008-05-18 06:22:34 +02:00
|
|
|
Dispatcher.to_prepare { a = b = c = 1 }
|
|
|
|
Dispatcher.to_prepare { b = c = 2 }
|
|
|
|
Dispatcher.to_prepare { c = 3 }
|
|
|
|
ActionController::Routing::Routes.expects(:reload)
|
2007-12-21 08:48:59 +01:00
|
|
|
|
2008-05-18 06:22:34 +02:00
|
|
|
reload!
|
2007-12-21 08:48:59 +01:00
|
|
|
|
2008-05-18 06:22:34 +02:00
|
|
|
assert_equal 1, a
|
|
|
|
assert_equal 2, b
|
|
|
|
assert_equal 3, c
|
|
|
|
end
|
2007-12-21 08:48:59 +01:00
|
|
|
end
|
|
|
|
end
|