aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r--actionpack/test/controller/log_subscriber_test.rb15
-rw-r--r--actionpack/test/controller/render_json_test.rb10
-rw-r--r--actionpack/test/controller/webservice_test.rb2
3 files changed, 26 insertions, 1 deletions
diff --git a/actionpack/test/controller/log_subscriber_test.rb b/actionpack/test/controller/log_subscriber_test.rb
index cac0881133..21bbd83653 100644
--- a/actionpack/test/controller/log_subscriber_test.rb
+++ b/actionpack/test/controller/log_subscriber_test.rb
@@ -32,6 +32,11 @@ module Another
cache_page("Super soaker", "/index.html")
render :nothing => true
end
+
+ def with_exception
+ raise Exception
+ end
+
end
end
@@ -168,6 +173,16 @@ class ACLogSubscriberTest < ActionController::TestCase
ensure
@controller.config.perform_caching = true
end
+
+ def test_process_action_with_exception_includes_http_status_code
+ begin
+ get :with_exception
+ wait
+ rescue Exception => e
+ end
+ assert_equal 2, logs.size
+ assert_match(/Completed 500/, logs.last)
+ end
def logs
@logs ||= @logger.logged(:info)
diff --git a/actionpack/test/controller/render_json_test.rb b/actionpack/test/controller/render_json_test.rb
index 6dd2a9f23d..fc604a2db3 100644
--- a/actionpack/test/controller/render_json_test.rb
+++ b/actionpack/test/controller/render_json_test.rb
@@ -26,6 +26,10 @@ class RenderJsonTest < ActionController::TestCase
render :json => nil
end
+ def render_json_render_to_string
+ render :text => render_to_string(:json => '[]')
+ end
+
def render_json_hello_world
render :json => ActiveSupport::JSON.encode(:hello => 'world')
end
@@ -76,6 +80,12 @@ class RenderJsonTest < ActionController::TestCase
assert_equal 'application/json', @response.content_type
end
+ def test_render_json_render_to_string
+ get :render_json_render_to_string
+ assert_equal '[]', @response.body
+ end
+
+
def test_render_json
get :render_json_hello_world
assert_equal '{"hello":"world"}', @response.body
diff --git a/actionpack/test/controller/webservice_test.rb b/actionpack/test/controller/webservice_test.rb
index 6ba4c6c48d..621fb79915 100644
--- a/actionpack/test/controller/webservice_test.rb
+++ b/actionpack/test/controller/webservice_test.rb
@@ -216,7 +216,7 @@ class WebServiceTest < ActionDispatch::IntegrationTest
def test_typecast_as_yaml
with_test_route_set do
with_params_parsers Mime::YAML => :yaml do
- yaml = <<-YAML
+ yaml = (<<-YAML).strip
---
data:
a: 15