diff options
author | David Chelimsky <dchelimsky@gmail.com> | 2011-04-09 12:51:22 -0500 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-04-13 21:45:51 +0200 |
commit | a26d407f6380493b39ad84e7f1b29899ead6a1f2 (patch) | |
tree | f6d965f07078c4a18adf6742ae233aef70174707 /actionpack/test/controller | |
parent | bd3b2241a43982f4f96015a1f841942cb8b0b973 (diff) | |
download | rails-a26d407f6380493b39ad84e7f1b29899ead6a1f2.tar.gz rails-a26d407f6380493b39ad84e7f1b29899ead6a1f2.tar.bz2 rails-a26d407f6380493b39ad84e7f1b29899ead6a1f2.zip |
ActionView::PathSet# accepts String or Array
- Closes #6692
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r-- | actionpack/test/controller/view_paths_test.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/actionpack/test/controller/view_paths_test.rb b/actionpack/test/controller/view_paths_test.rb index edfcb5cc4d..9280a1c2d3 100644 --- a/actionpack/test/controller/view_paths_test.rb +++ b/actionpack/test/controller/view_paths_test.rb @@ -131,6 +131,35 @@ class ViewLoadPathsTest < ActionController::TestCase assert_equal "Hello overridden world!", @response.body end + def test_override_view_paths_with_custom_resolver + resolver_class = Class.new(ActionView::PathResolver) do + def initialize(path_set) + @path_set = path_set + end + + def find_all(*args) + @path_set.find_all(*args).collect do |template| + ::ActionView::Template.new( + "Customized body", + template.identifier, + template.handler, + { + :virtual_path => template.virtual_path, + :format => template.formats + } + ) + end + end + end + + resolver = resolver_class.new(TestController.view_paths) + TestController.view_paths = ActionView::PathSet.new.push(resolver) + + get :hello_world + assert_response :success + assert_equal "Customized body", @response.body + end + def test_inheritance original_load_paths = ActionController::Base.view_paths |