diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2008-03-18 23:37:55 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2008-03-18 23:37:55 +0000 |
commit | eb837b52e34c1f7f0c71d704ffdb3e4eb4b582e2 (patch) | |
tree | 0dbd208f6a88b397624fd04b8beea31c0f9d7cc7 /actionpack | |
parent | dfa68883113045aad4bfab87c82b54d0c98d0a89 (diff) | |
download | rails-eb837b52e34c1f7f0c71d704ffdb3e4eb4b582e2.tar.gz rails-eb837b52e34c1f7f0c71d704ffdb3e4eb4b582e2.tar.bz2 rails-eb837b52e34c1f7f0c71d704ffdb3e4eb4b582e2.zip |
assert_response, don't cry if @exception isn't available in the template
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9059 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_controller/assertions/response_assertions.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/assertions/response_assertions.rb b/actionpack/lib/action_controller/assertions/response_assertions.rb index 67dd3a5724..c5fc6c7966 100644 --- a/actionpack/lib/action_controller/assertions/response_assertions.rb +++ b/actionpack/lib/action_controller/assertions/response_assertions.rb @@ -34,7 +34,9 @@ module ActionController assert_block("") { true } # to count the assertion else if @response.error? - 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 } + exception = @response.template.instance_variable_get(:@exception) + exception_message = exception && exception.message + assert_block(build_message(message, "Expected response to be a <?>, but was <?>\n<?>", type, @response.response_code, exception_message.to_s)) { false } else assert_block(build_message(message, "Expected response to be a <?>, but was <?>", type, @response.response_code)) { false } end |