2009-04-28 20:58:51 -04:00
|
|
|
require 'active_support'
|
|
|
|
require 'active_support/core/all'
|
2008-11-24 10:58:52 -05:00
|
|
|
require 'active_support/test_case'
|
|
|
|
require 'action_controller'
|
2006-03-01 10:52:40 -05:00
|
|
|
|
|
|
|
# work around the at_exit hook in test/unit, which kills IRB
|
2007-09-25 04:51:06 -04:00
|
|
|
Test::Unit.run = true if Test::Unit.respond_to?(:run=)
|
2006-03-01 10:52:40 -05:00
|
|
|
|
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..."
|
2009-05-17 14:39:44 -04:00
|
|
|
ActionController::Dispatcher.new
|
|
|
|
ActionController::Dispatcher.router.reload
|
2007-09-25 21:24:07 -04:00
|
|
|
true
|
2006-03-03 16:24:39 -05:00
|
|
|
end
|