1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

add tests to make sure deprecated API is still supported

This commit is contained in:
Aaron Patterson 2019-01-31 13:47:03 -08:00
parent 315b9def91
commit eda0f574f1
No known key found for this signature in database
GPG key ID: 953170BCB4FFAFC6
2 changed files with 14 additions and 2 deletions

View file

@ -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

View file

@ -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