diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2015-04-06 12:40:02 +0200 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2015-04-06 12:40:02 +0200 |
commit | ca4417d333292b5d345cc64d3e4bbff1b491e8e3 (patch) | |
tree | f8a26e4abe62be6dea09924864be6b939c3bf2f8 /actionpack/test | |
parent | 51eacc71c7d2a6d0fc23556b32e12a21ee49b948 (diff) | |
parent | 0de4a23d1cfa6ef44a27ac8aca5055487282460e (diff) | |
download | rails-ca4417d333292b5d345cc64d3e4bbff1b491e8e3.tar.gz rails-ca4417d333292b5d345cc64d3e4bbff1b491e8e3.tar.bz2 rails-ca4417d333292b5d345cc64d3e4bbff1b491e8e3.zip |
Merge pull request #19377 from sb8244/issue-19036
when a template is missing for the default render, do head no_content instead
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/controller/mime/respond_to_test.rb | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/actionpack/test/controller/mime/respond_to_test.rb b/actionpack/test/controller/mime/respond_to_test.rb index 1f5f66dc80..21407f3966 100644 --- a/actionpack/test/controller/mime/respond_to_test.rb +++ b/actionpack/test/controller/mime/respond_to_test.rb @@ -608,19 +608,29 @@ class RespondToControllerTest < ActionController::TestCase end def test_invalid_variant + logger = ActiveSupport::LogSubscriber::TestHelper::MockLogger.new + old_logger, ActionController::Base.logger = ActionController::Base.logger, logger + @request.variant = :invalid - assert_raises(ActionView::MissingTemplate) do - get :variant_with_implicit_rendering - end + get :variant_with_implicit_rendering + assert_response :no_content + assert_equal 1, logger.logged(:info).select{ |s| s =~ /No template found/ }.size, "Implicit head :no_content not logged" + ensure + ActionController::Base.logger = old_logger end def test_variant_not_set_regular_template_missing - assert_raises(ActionView::MissingTemplate) do - get :variant_with_implicit_rendering - end + get :variant_with_implicit_rendering + assert_response :no_content end def test_variant_with_implicit_rendering + @request.variant = :implicit + get :variant_with_implicit_rendering + assert_response :no_content + end + + def test_variant_with_implicit_template_rendering @request.variant = :mobile get :variant_with_implicit_rendering assert_equal "text/html", @response.content_type |