Skip to content

Commit 4d69cdb

Browse files
Merge pull request rails#6777 from route/logger_in_metal_tests
Added test for case when view doesn't have logger method when using ActionController::Metal controller.
2 parents 23c5894 + e8f9e66 commit 4d69cdb

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

actionpack/test/controller/render_test.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,14 @@ def determine_layout
730730
end
731731
end
732732

733+
class MetalTestController < ActionController::Metal
734+
include ActionController::Rendering
735+
736+
def accessing_logger_in_template
737+
render :inline => "<%= logger.class %>"
738+
end
739+
end
740+
733741
class RenderTest < ActionController::TestCase
734742
tests TestController
735743

@@ -1617,3 +1625,12 @@ def test_last_modified_works_with_less_than_too
16171625
assert_response :success
16181626
end
16191627
end
1628+
1629+
class MetalRenderTest < ActionController::TestCase
1630+
tests MetalTestController
1631+
1632+
def test_access_to_logger_in_view
1633+
get :accessing_logger_in_template
1634+
assert_equal "NilClass", @response.body
1635+
end
1636+
end

0 commit comments

Comments
 (0)