aboutsummaryrefslogtreecommitdiffstats
path: root/actionview
diff options
context:
space:
mode:
Diffstat (limited to 'actionview')
-rw-r--r--actionview/lib/action_view/base.rb6
-rw-r--r--actionview/test/template/render_test.rb10
2 files changed, 14 insertions, 2 deletions
diff --git a/actionview/lib/action_view/base.rb b/actionview/lib/action_view/base.rb
index fe9f3f9503..b143e13c96 100644
--- a/actionview/lib/action_view/base.rb
+++ b/actionview/lib/action_view/base.rb
@@ -224,10 +224,12 @@ module ActionView #:nodoc:
# :startdoc:
- def initialize(renderer, assigns = {}, controller = nil, formats = NULL) #:nodoc:
+ def initialize(renderer = nil, assigns = {}, controller = nil, formats = NULL) #:nodoc:
@_config = ActiveSupport::InheritableOptions.new
- unless formats == NULL
+ if formats == NULL
+ formats = nil
+ else
ActiveSupport::Deprecation.warn <<~eowarn
Passing formats to ActionView::Base.new is deprecated
eowarn
diff --git a/actionview/test/template/render_test.rb b/actionview/test/template/render_test.rb
index ab67423ea1..76ffe3415d 100644
--- a/actionview/test/template/render_test.rb
+++ b/actionview/test/template/render_test.rb
@@ -336,6 +336,16 @@ module RenderTestCases
assert_equal "Hello: davidHello: mary", @view.render(partial: "test/customer", collection: customers)
end
+ def test_deprecated_constructor
+ assert_deprecated do
+ ActionView::Base.new
+ end
+
+ assert_deprecated do
+ ActionView::Base.new ["/a"]
+ end
+ end
+
def test_render_partial_without_object_does_not_put_partial_name_to_local_assigns
assert_equal "false", @view.render(partial: "test/partial_name_in_local_assigns")
end