diff options
author | Chris Hapgood <cch1@hapgoods.com> | 2008-05-16 11:27:09 -0400 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2008-05-19 11:20:36 +0100 |
commit | e6f5079a48094eeba3dab9dca52b16b58ddc3634 (patch) | |
tree | d3acbe17454f6f3995eff4314d36440ddaa089de /actionpack | |
parent | 99860b72aebe0348f41e82d4710343498d89a84b (diff) | |
download | rails-e6f5079a48094eeba3dab9dca52b16b58ddc3634.tar.gz rails-e6f5079a48094eeba3dab9dca52b16b58ddc3634.tar.bz2 rails-e6f5079a48094eeba3dab9dca52b16b58ddc3634.zip |
Test for assert_response for failure response without an exception. [#141 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/test/controller/action_pack_assertions_test.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/actionpack/test/controller/action_pack_assertions_test.rb b/actionpack/test/controller/action_pack_assertions_test.rb index 1db057580b..f152b1d19c 100644 --- a/actionpack/test/controller/action_pack_assertions_test.rb +++ b/actionpack/test/controller/action_pack_assertions_test.rb @@ -131,6 +131,10 @@ class AssertResponseWithUnexpectedErrorController < ActionController::Base def index raise 'FAIL' end + + def show + render :text => "Boom", :status => 500 + end end module Admin @@ -483,6 +487,16 @@ class ActionPackAssertionsControllerTest < Test::Unit::TestCase rescue Test::Unit::AssertionFailedError => e assert e.message.include?('FAIL') end + + def test_assert_response_failure_response_with_no_exception + @controller = AssertResponseWithUnexpectedErrorController.new + get :show + assert_response :success + flunk 'Expected non-success response' + rescue Test::Unit::AssertionFailedError + rescue + flunk "assert_response failed to handle failure response with missing, but optional, exception." + end end class ActionPackHeaderTest < Test::Unit::TestCase |