mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
render_to_string Regression Outside of Real Requests in Rails 5.0.0.rc1 (#25308)
* Restore the functionality of PR#14129, but do so with not nil to better indicate the purpose of the conditional * Add a test when render_to_string called on ActionController::Base.new()
This commit is contained in:
parent
6990fd3e2a
commit
f12c42fff2
2 changed files with 8 additions and 1 deletions
|
@ -122,7 +122,7 @@ module AbstractController
|
|||
def _normalize_render(*args, &block)
|
||||
options = _normalize_args(*args, &block)
|
||||
#TODO: remove defined? when we restore AP <=> AV dependency
|
||||
if defined?(request) && request.variant.present?
|
||||
if defined?(request) && !request.nil? && request.variant.present?
|
||||
options[:variant] = request.variant
|
||||
end
|
||||
_normalize_options(options)
|
||||
|
|
|
@ -564,6 +564,13 @@ class MetalRenderTest < ActionController::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
class ActionControllerBaseRenderTest < ActionController::TestCase
|
||||
def test_direct_render_to_string
|
||||
ac = ActionController::Base.new()
|
||||
assert_equal "Hello world!", ac.render_to_string(template: 'test/hello_world')
|
||||
end
|
||||
end
|
||||
|
||||
class ImplicitRenderTest < ActionController::TestCase
|
||||
tests ImplicitRenderTestController
|
||||
|
||||
|
|
Loading…
Reference in a new issue