d7d01d703fc2260444787119f428cd1a87fe893d
[feedcatcher.git] / vendor / rails / railties / lib / console_app.rb
1 require 'active_support/test_case'
2 require 'action_controller'
3
4 # work around the at_exit hook in test/unit, which kills IRB
5 Test::Unit.run = true if Test::Unit.respond_to?(:run=)
6
7 # reference the global "app" instance, created on demand. To recreate the
8 # instance, pass a non-false value as the parameter.
9 def app(create=false)
10 @app_integration_instance = nil if create
11 @app_integration_instance ||= new_session do |sess|
12 sess.host! "www.example.com"
13 end
14 end
15
16 # create a new session. If a block is given, the new session will be yielded
17 # to the block before being returned.
18 def new_session
19 session = ActionController::Integration::Session.new
20 yield session if block_given?
21 session
22 end
23
24 #reloads the environment
25 def reload!
26 puts "Reloading..."
27 Dispatcher.cleanup_application
28 Dispatcher.reload_application
29 true
30 end