diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2015-06-27 22:18:17 +0200 |
---|---|---|
committer | Kasper Timm Hansen <kaspth@gmail.com> | 2015-06-27 22:18:17 +0200 |
commit | 991e98f5640874a9bda41855af4f9315aff8260a (patch) | |
tree | 3ac737a8da60859ab97c94707884a033e0bbfffe /actionpack/test | |
parent | a821ec13f3648218b6b38aa1e41206e4341979d4 (diff) | |
parent | 6fda6c3778b27ea9ca70645bb65956154c2da27b (diff) | |
download | rails-991e98f5640874a9bda41855af4f9315aff8260a.tar.gz rails-991e98f5640874a9bda41855af4f9315aff8260a.tar.bz2 rails-991e98f5640874a9bda41855af4f9315aff8260a.zip |
Merge pull request #20276 from davetron5000/revert-head-on-no-template
Allow default_render to take a block to customize behavior when there's no template
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/controller/mime/respond_to_test.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/actionpack/test/controller/mime/respond_to_test.rb b/actionpack/test/controller/mime/respond_to_test.rb index 7aef8a50ce..8591bdb4d9 100644 --- a/actionpack/test/controller/mime/respond_to_test.rb +++ b/actionpack/test/controller/mime/respond_to_test.rb @@ -793,3 +793,24 @@ class RespondToControllerTest < ActionController::TestCase assert_equal "phone", @response.body end end + +class RespondToWithBlockOnDefaultRenderController < ActionController::Base + def show + default_render do + render text: 'default_render yielded' + end + end +end + +class RespondToWithBlockOnDefaultRenderControllerTest < ActionController::TestCase + def setup + super + @request.host = "www.example.com" + end + + def test_default_render_uses_block_when_no_template_exists + get :show + assert_equal "default_render yielded", @response.body + assert_equal "text/html", @response.content_type + end +end |