aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/view_paths_test.rb
diff options
context:
space:
mode:
authorGonçalo Silva <goncalossilva@gmail.com>2011-04-17 17:08:49 +0100
committerGonçalo Silva <goncalossilva@gmail.com>2011-04-17 17:08:49 +0100
commit1c2b2233c3a7ec76c0a0eddf5b8be45c489be133 (patch)
tree56f2b767c3a4f1f14c51606bf2cbb714a98c5f89 /actionpack/test/controller/view_paths_test.rb
parent8d558cb1b069410c8f693295c9c4e2ffc9661e06 (diff)
parentb6843f22ac42b503f6b8ac00105ca0679049be7d (diff)
downloadrails-1c2b2233c3a7ec76c0a0eddf5b8be45c489be133.tar.gz
rails-1c2b2233c3a7ec76c0a0eddf5b8be45c489be133.tar.bz2
rails-1c2b2233c3a7ec76c0a0eddf5b8be45c489be133.zip
Merge branch 'master' of https://github.com/rails/rails into performance_test
Diffstat (limited to 'actionpack/test/controller/view_paths_test.rb')
-rw-r--r--actionpack/test/controller/view_paths_test.rb29
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