Test for assert_response for failure response without an exception. [#141 state:resolved]

Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
This commit is contained in:
Chris Hapgood
2008-05-16 11:27:09 -04:00
committed by Pratik Naik
parent 99860b72ae
commit e6f5079a48

View File

@@ -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