~michaelforrest/use-case-mapper/trunk

« back to all changes in this revision

Viewing changes to vendor/rails/railties/lib/console_app.rb

  • Committer: Richard Lee (Canonical)
  • Date: 2010-10-15 15:17:58 UTC
  • mfrom: (190.1.3 use-case-mapper)
  • Revision ID: richard.lee@canonical.com-20101015151758-wcvmfxrexsongf9d
Merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
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