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

root/branches/2-1-caching/actionpack/test/abstract_unit.rb

Revision 7640, 1.0 kB (checked in by bitsweat, 1 year ago)

Move Railties' Dispatcher to ActionController::Dispatcher, introduce before_ and after_dispatch callbacks, and warm up to non-CGI requests.

Line 
1 $:.unshift(File.dirname(__FILE__) + '/../lib')
2 $:.unshift(File.dirname(__FILE__) + '/../../activesupport/lib/active_support')
3 $:.unshift(File.dirname(__FILE__) + '/fixtures/helpers')
4
5 require 'yaml'
6 require 'stringio'
7 require 'test/unit'
8 require 'action_controller'
9 require 'action_controller/cgi_ext'
10 require 'action_controller/test_process'
11
12 begin
13   require 'ruby-debug'
14 rescue LoadError
15   # Debugging disabled. `gem install ruby-debug` to enable.
16 end
17
18 # Show backtraces for deprecated behavior for quicker cleanup.
19 ActiveSupport::Deprecation.debug = true
20
21 ActionController::Base.logger = nil
22 ActionController::Base.ignore_missing_templates = false
23 ActionController::Routing::Routes.reload rescue nil
24
25
26 # Wrap tests that use Mocha and skip if unavailable.
27 def uses_mocha(test_name)
28   unless Object.const_defined?(:Mocha)
29     require 'mocha'
30     require 'stubba'
31   end
32   yield
33 rescue LoadError => load_error
34   raise unless load_error.message =~ /mocha/i
35   $stderr.puts "Skipping #{test_name} tests. `gem install mocha` and try again."
36 end
Note: See TracBrowser for help on using the browser.