2006-03-18 09:27:36 -05:00
|
|
|
require 'action_controller/integration'
|
2006-03-01 10:52:40 -05:00
|
|
|
|
|
|
|
# work around the at_exit hook in test/unit, which kills IRB
|
|
|
|
Test::Unit.run = true
|
|
|
|
|
2006-03-01 11:22:26 -05:00
|
|
|
# reference the global "app" instance, created on demand. To recreate the
|
|
|
|
# instance, pass a non-false value as the parameter.
|
2006-03-01 10:52:40 -05:00
|
|
|
def app(create=false)
|
|
|
|
@app_integration_instance = nil if create
|
2006-03-01 11:22:26 -05:00
|
|
|
@app_integration_instance ||= new_session do |sess|
|
2006-03-25 14:43:40 -05:00
|
|
|
sess.host! "www.example.com"
|
2006-03-01 10:52:40 -05:00
|
|
|
end
|
2006-03-01 11:22:26 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
# create a new session. If a block is given, the new session will be yielded
|
|
|
|
# to the block before being returned.
|
|
|
|
def new_session
|
|
|
|
session = ActionController::Integration::Session.new
|
|
|
|
yield session if block_given?
|
|
|
|
session
|
2006-03-02 22:00:55 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
#reloads the environment
|
|
|
|
def reload!
|
|
|
|
puts "Reloading..."
|
|
|
|
Dispatcher.reset_application!
|
2006-03-03 16:24:39 -05:00
|
|
|
end
|