aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorMatthew Draper <matthew@trebex.net>2016-06-01 08:15:48 +0930
committerMatthew Draper <matthew@trebex.net>2016-06-01 09:03:24 +0930
commit6d4ac2726f56c33677867178e2e01e5237df780a (patch)
tree75f140d3f8ed6e6656390b0867829b59a0e1415f /actionpack/test
parentc4cb6862babd2665a65056e205c2a5fd17a5d99d (diff)
downloadrails-6d4ac2726f56c33677867178e2e01e5237df780a.tar.gz
rails-6d4ac2726f56c33677867178e2e01e5237df780a.tar.bz2
rails-6d4ac2726f56c33677867178e2e01e5237df780a.zip
Clean up the test request/response even after an exception
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/controller/test_case_test.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/actionpack/test/controller/test_case_test.rb b/actionpack/test/controller/test_case_test.rb
index 6160b3395a..ea59156f65 100644
--- a/actionpack/test/controller/test_case_test.rb
+++ b/actionpack/test/controller/test_case_test.rb
@@ -154,6 +154,10 @@ XML
render html: '<body class="foo"></body>'.html_safe
end
+ def boom
+ raise 'boom!'
+ end
+
private
def generate_url(opts)
@@ -981,6 +985,26 @@ XML
assert_redirected_to 'created resource'
end
end
+
+ def test_exception_in_action_reaches_test
+ assert_raise(RuntimeError) do
+ process :boom, method: "GET"
+ end
+ end
+
+ def test_request_state_is_cleared_after_exception
+ assert_raise(RuntimeError) do
+ process :boom,
+ method: "GET",
+ params: { q: 'test1' }
+ end
+
+ process :test_query_string,
+ method: "GET",
+ params: { q: 'test2' }
+
+ assert_equal "q=test2", @response.body
+ end
end
class ResponseDefaultHeadersTest < ActionController::TestCase