mirror of
https://github.com/github/rails.git
synced 2026-02-05 11:45:13 -05:00
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:
committed by
Pratik Naik
parent
99860b72ae
commit
e6f5079a48
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user