2007-01-22 14:43:50 +01:00
|
|
|
$:.unshift(File.dirname(__FILE__) + '/../lib')
|
2008-10-27 07:47:01 +01:00
|
|
|
$:.unshift(File.dirname(__FILE__) + '/../../activesupport/lib')
|
2007-01-22 14:43:50 +01:00
|
|
|
$:.unshift(File.dirname(__FILE__) + '/fixtures/helpers')
|
|
|
|
|
|
|
|
require 'yaml'
|
2007-12-21 08:48:59 +01:00
|
|
|
require 'stringio'
|
2007-01-22 14:43:50 +01:00
|
|
|
require 'test/unit'
|
|
|
|
require 'action_controller'
|
2007-12-21 08:48:59 +01:00
|
|
|
require 'action_controller/cgi_ext'
|
2007-01-22 14:43:50 +01:00
|
|
|
require 'action_controller/test_process'
|
2008-05-18 06:22:34 +02:00
|
|
|
require 'action_view/test_case'
|
2007-01-22 14:43:50 +01:00
|
|
|
|
2007-12-21 08:48:59 +01:00
|
|
|
begin
|
|
|
|
require 'ruby-debug'
|
|
|
|
rescue LoadError
|
|
|
|
# Debugging disabled. `gem install ruby-debug` to enable.
|
|
|
|
end
|
|
|
|
|
2007-02-09 09:04:31 +01:00
|
|
|
# Show backtraces for deprecated behavior for quicker cleanup.
|
|
|
|
ActiveSupport::Deprecation.debug = true
|
|
|
|
|
2007-01-22 14:43:50 +01:00
|
|
|
ActionController::Base.logger = nil
|
2007-02-09 09:04:31 +01:00
|
|
|
ActionController::Routing::Routes.reload rescue nil
|
2007-12-21 08:48:59 +01:00
|
|
|
|
2008-10-27 07:47:01 +01:00
|
|
|
FIXTURE_LOAD_PATH = File.join(File.dirname(__FILE__), 'fixtures')
|
|
|
|
ActionView::PathSet::Path.eager_load_templates!
|
|
|
|
ActionController::Base.view_paths = FIXTURE_LOAD_PATH
|
2007-12-21 08:48:59 +01:00
|
|
|
|
|
|
|
# Wrap tests that use Mocha and skip if unavailable.
|
|
|
|
def uses_mocha(test_name)
|
|
|
|
unless Object.const_defined?(:Mocha)
|
|
|
|
require 'mocha'
|
|
|
|
require 'stubba'
|
|
|
|
end
|
|
|
|
yield
|
|
|
|
rescue LoadError => load_error
|
|
|
|
raise unless load_error.message =~ /mocha/i
|
|
|
|
$stderr.puts "Skipping #{test_name} tests. `gem install mocha` and try again."
|
|
|
|
end
|