aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/action_pack_assertions_test.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2008-01-05 02:19:48 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2008-01-05 02:19:48 +0000
commit3464a7e79c373947ea7d57c543e36f41bd62049e (patch)
tree263bf0024f4334a3276922e3c062cc5c3674e61d /actionpack/test/controller/action_pack_assertions_test.rb
parent5ccc3cf448c5ba41761d1f50a476f6793331511d (diff)
downloadrails-3464a7e79c373947ea7d57c543e36f41bd62049e.tar.gz
rails-3464a7e79c373947ea7d57c543e36f41bd62049e.tar.bz2
rails-3464a7e79c373947ea7d57c543e36f41bd62049e.zip
assert_response failures include the exception message. Closes #10688.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8559 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/controller/action_pack_assertions_test.rb')
-rw-r--r--actionpack/test/controller/action_pack_assertions_test.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/actionpack/test/controller/action_pack_assertions_test.rb b/actionpack/test/controller/action_pack_assertions_test.rb
index 1eb9610d04..b1006f82be 100644
--- a/actionpack/test/controller/action_pack_assertions_test.rb
+++ b/actionpack/test/controller/action_pack_assertions_test.rb
@@ -124,6 +124,15 @@ class ActionPackAssertionsController < ActionController::Base
def rescue_action(e) raise; end
end
+# Used to test that assert_response includes the exception message
+# in the failure message when an action raises and assert_response
+# is expecting something other than an error.
+class AssertResponseWithUnexpectedErrorController < ActionController::Base
+ def index
+ raise 'FAIL'
+ end
+end
+
module Admin
class InnerModuleController < ActionController::Base
def index
@@ -465,6 +474,15 @@ class ActionPackAssertionsControllerTest < Test::Unit::TestCase
rescue Test::Unit::AssertionFailedError => e
end
end
+
+ def test_assert_response_uses_exception_message
+ @controller = AssertResponseWithUnexpectedErrorController.new
+ get :index
+ assert_response :success
+ flunk 'Expected non-success response'
+ rescue Test::Unit::AssertionFailedError => e
+ assert e.message.include?('FAIL')
+ end
end
class ActionPackHeaderTest < Test::Unit::TestCase