diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2008-07-17 11:52:56 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2008-07-17 11:52:56 -0700 |
commit | 636e6b7138864ceb1e309939cd879e710b287f3e (patch) | |
tree | 2a36dfef02f706302a20bb5b2d428b32e9af97f0 /actionpack/lib/action_controller/test_case.rb | |
parent | 842917dea0cfdf70f158a312cc1f77f769791d8c (diff) | |
parent | 99930d499e424f4560b371412e05d10476216ece (diff) | |
download | rails-636e6b7138864ceb1e309939cd879e710b287f3e.tar.gz rails-636e6b7138864ceb1e309939cd879e710b287f3e.tar.bz2 rails-636e6b7138864ceb1e309939cd879e710b287f3e.zip |
Merge branch 'master' into i18n-merge
Conflicts:
actionpack/lib/action_view/helpers/form_options_helper.rb
activerecord/lib/active_record/validations.rb
Diffstat (limited to 'actionpack/lib/action_controller/test_case.rb')
-rw-r--r-- | actionpack/lib/action_controller/test_case.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb index 77c6f26eac..c09050c390 100644 --- a/actionpack/lib/action_controller/test_case.rb +++ b/actionpack/lib/action_controller/test_case.rb @@ -15,6 +15,27 @@ module ActionController end end + # Superclass for Action Controller functional tests. Infers the controller under test from the test class name, + # and creates @controller, @request, @response instance variables. + # + # class WidgetsControllerTest < ActionController::TestCase + # def test_index + # get :index + # end + # end + # + # * @controller - WidgetController.new + # * @request - ActionController::TestRequest.new + # * @response - ActionController::TestResponse.new + # + # (Earlier versions of Rails required each functional test to subclass Test::Unit::TestCase and define + # @controller, @request, @response in +setup+.) + # + # If the controller cannot be inferred from the test class name, you can explicity set it with +tests+. + # + # class SpecialEdgeCaseWidgetsControllerTest < ActionController::TestCase + # tests WidgetController + # end class TestCase < ActiveSupport::TestCase # When the request.remote_addr remains the default for testing, which is 0.0.0.0, the exception is simply raised inline # (bystepping the regular exception handling from rescue_action). If the request.remote_addr is anything else, the regular @@ -41,6 +62,8 @@ module ActionController @@controller_class = nil class << self + # Sets the controller class name. Useful if the name can't be inferred from test class. + # Expects +controller_class+ as a constant. Example: <tt>tests WidgetController</tt>. def tests(controller_class) self.controller_class = controller_class end |