aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test/actionpack
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2019-01-29 15:17:52 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2019-01-29 15:49:40 -0800
commite17fe52e0e0ef0842b6c409e1110a862c4e005bc (patch)
treefcc3617c202d873ffed4d99844fbd7d6f6712cd0 /actionview/test/actionpack
parent94d54fa4ab641a0ddeb173409cb41cc5becc02a9 (diff)
downloadrails-e17fe52e0e0ef0842b6c409e1110a862c4e005bc.tar.gz
rails-e17fe52e0e0ef0842b6c409e1110a862c4e005bc.tar.bz2
rails-e17fe52e0e0ef0842b6c409e1110a862c4e005bc.zip
Tighten up the AV::Base constructor
The AV::Base constructor was too complicated, and this commit tightens up the parameters it will take. At runtime, AV::Base is most commonly constructed here: https://github.com/rails/rails/blob/94d54fa4ab641a0ddeb173409cb41cc5becc02a9/actionview/lib/action_view/rendering.rb#L72-L74 This provides an AV::Renderer instance, a hash of assignments, and a controller instance. Since this is the common case for construction, we should remove logic from the constructor that handles other cases. This commit introduces special constructors for those other cases. Interestingly, most code paths that construct AV::Base "strangely" are tests.
Diffstat (limited to 'actionview/test/actionpack')
-rw-r--r--actionview/test/actionpack/controller/view_paths_test.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/actionview/test/actionpack/controller/view_paths_test.rb b/actionview/test/actionpack/controller/view_paths_test.rb
index 7f3fe0fa08..c5238dd746 100644
--- a/actionview/test/actionpack/controller/view_paths_test.rb
+++ b/actionview/test/actionpack/controller/view_paths_test.rb
@@ -77,7 +77,7 @@ class ViewLoadPathsTest < ActionController::TestCase
end
def test_template_appends_view_path_correctly
- @controller.instance_variable_set :@template, ActionView::Base.new(TestController.view_paths, {}, @controller)
+ @controller.instance_variable_set :@template, ActionView::Base.with_view_paths(TestController.view_paths, {}, @controller)
class_view_paths = TestController.view_paths
@controller.append_view_path "foo"
@@ -89,7 +89,7 @@ class ViewLoadPathsTest < ActionController::TestCase
end
def test_template_prepends_view_path_correctly
- @controller.instance_variable_set :@template, ActionView::Base.new(TestController.view_paths, {}, @controller)
+ @controller.instance_variable_set :@template, ActionView::Base.with_view_paths(TestController.view_paths, {}, @controller)
class_view_paths = TestController.view_paths
@controller.prepend_view_path "baz"