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

root/tags/rel_1-2-1/railties/lib/console_app.rb

Revision 4026, 0.7 kB (checked in by david, 3 years ago)

Use example.com as standard (closes #4413) [anna]

Line 
1 require 'action_controller/integration'
2
3 # work around the at_exit hook in test/unit, which kills IRB
4 Test::Unit.run = true
5
6 # reference the global "app" instance, created on demand. To recreate the
7 # instance, pass a non-false value as the parameter.
8 def app(create=false)
9   @app_integration_instance = nil if create
10   @app_integration_instance ||= new_session do |sess|
11     sess.host! "www.example.com"
12   end
13 end
14
15 # create a new session. If a block is given, the new session will be yielded
16 # to the block before being returned.
17 def new_session
18   session = ActionController::Integration::Session.new
19   yield session if block_given?
20   session
21 end
22
23 #reloads the environment
24 def reload!
25   puts "Reloading..."
26   Dispatcher.reset_application!
27 end
Note: See TracBrowser for help on using the browser.