Changeset 8559
- Timestamp:
- 01/05/08 02:19:48 (6 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/actionpack/CHANGELOG
r8546 r8559 1 1 *SVN* 2 3 * assert_response failures include the exception message. #10688 [Seth Rasmussen] 2 4 3 5 * All fragment cache keys are now by default prefixed with the "views/" namespace [DHH] trunk/actionpack/lib/action_controller/assertions/response_assertions.rb
r8300 r8559 34 34 assert_block("") { true } # to count the assertion 35 35 else 36 assert_block(build_message(message, "Expected response to be a <?>, but was <?>", type, @response.response_code)) { false } 36 if @response.error? 37 assert_block(build_message(message, "Expected response to be a <?>, but was <?>\n<?>", type, @response.response_code, @response.template.instance_variable_get(:@exception).message)) { false } 38 else 39 assert_block(build_message(message, "Expected response to be a <?>, but was <?>", type, @response.response_code)) { false } 40 end 37 41 end 38 42 end trunk/actionpack/test/controller/action_pack_assertions_test.rb
r7776 r8559 123 123 # 911 124 124 def rescue_action(e) raise; end 125 end 126 127 # Used to test that assert_response includes the exception message 128 # in the failure message when an action raises and assert_response 129 # is expecting something other than an error. 130 class AssertResponseWithUnexpectedErrorController < ActionController::Base 131 def index 132 raise 'FAIL' 133 end 125 134 end 126 135 … … 466 475 end 467 476 end 477 478 def test_assert_response_uses_exception_message 479 @controller = AssertResponseWithUnexpectedErrorController.new 480 get :index 481 assert_response :success 482 flunk 'Expected non-success response' 483 rescue Test::Unit::AssertionFailedError => e 484 assert e.message.include?('FAIL') 485 end 468 486 end 469 487