diff options
author | Rick Olson <technoweenie@gmail.com> | 2006-12-19 04:41:57 +0000 |
---|---|---|
committer | Rick Olson <technoweenie@gmail.com> | 2006-12-19 04:41:57 +0000 |
commit | e7c2c7982f25edcc359a3d6753bf41def1fc161e (patch) | |
tree | c4f862d25266e05319655e22e4793faeeb73dd65 /actionpack/test | |
parent | 41466a4c83e3e590b580d5d2cbc5869e601e7599 (diff) | |
download | rails-e7c2c7982f25edcc359a3d6753bf41def1fc161e.tar.gz rails-e7c2c7982f25edcc359a3d6753bf41def1fc161e.tar.bz2 rails-e7c2c7982f25edcc359a3d6753bf41def1fc161e.zip |
Ensure render :json => ... skips the layout. Closes #6808 [Josh Peek]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5746 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/controller/render_test.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/actionpack/test/controller/render_test.rb b/actionpack/test/controller/render_test.rb index b223862c9e..d364dd6c93 100644 --- a/actionpack/test/controller/render_test.rb +++ b/actionpack/test/controller/render_test.rb @@ -47,6 +47,10 @@ class TestController < ActionController::Base render_json({:hello => 'world'}.to_json, 'alert') end + def render_symbol_json + render :json => {:hello => 'world'}.to_json + end + def render_custom_code render_text "hello world", "404 Moved" end @@ -125,6 +129,7 @@ class TestController < ActionController::Base case action_name when "layout_test": "layouts/standard" when "builder_layout_test": "layouts/builder" + when "render_symbol_json": "layouts/standard" # to make sure layouts don't interfere end end end @@ -184,6 +189,12 @@ class RenderTest < Test::Unit::TestCase assert_equal 'application/json', @response.content_type end + def test_do_with_render_symbol_json + get :render_symbol_json + assert_equal '{hello: "world"}', @response.body + assert_equal 'application/json', @response.content_type + end + def test_do_with_render_custom_code get :render_custom_code assert_response 404 |