diff options
author | Azul <azul@leap.se> | 2013-09-02 09:29:48 +0200 |
---|---|---|
committer | Azul <azul@leap.se> | 2013-09-03 08:30:12 +0200 |
commit | 1210f91251b14c251b2d4a6de7665fa520b77864 (patch) | |
tree | a01a32cfeb6ebe7ffc4c1e9e826dd36cb55dd9f8 /test/functional | |
parent | a78b5f2a6aa25bfe9a34e865f128289d9bb8f3c0 (diff) |
Test the error handling of json and html responses
Diffstat (limited to 'test/functional')
-rw-r--r-- | test/functional/error_handling_test.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/functional/error_handling_test.rb b/test/functional/error_handling_test.rb new file mode 100644 index 0000000..04ea722 --- /dev/null +++ b/test/functional/error_handling_test.rb @@ -0,0 +1,20 @@ +require 'test_helper' + +class ErrorHandlingTest < ActionController::TestCase + tests HomeController + + def setup + HomeController.any_instance.stubs(:index).raises + end + + def test_json_error + get :index, format: :json + assert_equal 'application/json', @response.content_type + end + + def test_html_error_reraises + assert_raises RuntimeError do + get :index + end + end +end |