diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2019-01-31 13:47:03 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2019-01-31 13:47:13 -0800 |
commit | eda0f574f129fcd5ad1fc58b55cb6d1db71ea95c (patch) | |
tree | 4e3579e847147e4e54f994c6f7cce590ab92bcdf | |
parent | 315b9def911b9d8519926e59b02a65a7eca16d30 (diff) | |
download | rails-eda0f574f129fcd5ad1fc58b55cb6d1db71ea95c.tar.gz rails-eda0f574f129fcd5ad1fc58b55cb6d1db71ea95c.tar.bz2 rails-eda0f574f129fcd5ad1fc58b55cb6d1db71ea95c.zip |
add tests to make sure deprecated API is still supported
-rw-r--r-- | actionview/lib/action_view/base.rb | 6 | ||||
-rw-r--r-- | actionview/test/template/render_test.rb | 10 |
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 |