aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/view_paths_test.rb
diff options
context:
space:
mode:
authorRick Olson <technoweenie@gmail.com>2007-11-26 03:59:23 +0000
committerRick Olson <technoweenie@gmail.com>2007-11-26 03:59:23 +0000
commit87e506da535118d77b58484a4e6e2d1cd9e13b53 (patch)
treefc80941c104799d584838ba8cc3b7954171d0e72 /actionpack/test/controller/view_paths_test.rb
parent1af084ecda66a8e1b4eb3a51a07ebca85bf2e419 (diff)
downloadrails-87e506da535118d77b58484a4e6e2d1cd9e13b53.tar.gz
rails-87e506da535118d77b58484a4e6e2d1cd9e13b53.tar.bz2
rails-87e506da535118d77b58484a4e6e2d1cd9e13b53.zip
Add #prepend_view_path and #append_view_path instance methods on ActionController::Base for consistency with the class methods. [rick]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8214 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/controller/view_paths_test.rb')
-rw-r--r--actionpack/test/controller/view_paths_test.rb28
1 files changed, 26 insertions, 2 deletions
diff --git a/actionpack/test/controller/view_paths_test.rb b/actionpack/test/controller/view_paths_test.rb
index a29247ad44..e29e2b9f3c 100644
--- a/actionpack/test/controller/view_paths_test.rb
+++ b/actionpack/test/controller/view_paths_test.rb
@@ -47,7 +47,7 @@ class ViewLoadPathsTest < Test::Unit::TestCase
assert_equal [ LOAD_PATH_ROOT ], @controller.view_paths
end
- def test_template_appends_path_correctly
+ def test_controller_appends_view_path_correctly
TestController.append_view_path 'foo'
assert_equal [LOAD_PATH_ROOT, 'foo'], @controller.view_paths
@@ -55,7 +55,7 @@ class ViewLoadPathsTest < Test::Unit::TestCase
assert_equal [LOAD_PATH_ROOT, 'foo', 'bar', 'baz'], @controller.view_paths
end
- def test_template_prepends_path_correctly
+ def test_controller_prepends_view_path_correctly
TestController.prepend_view_path 'baz'
assert_equal ['baz', LOAD_PATH_ROOT], @controller.view_paths
@@ -63,6 +63,30 @@ class ViewLoadPathsTest < Test::Unit::TestCase
assert_equal ['foo', 'bar', 'baz', LOAD_PATH_ROOT], @controller.view_paths
end
+ def test_template_appends_view_path_correctly
+ @controller.instance_variable_set :@template, ActionView::Base.new(TestController.view_paths, {}, @controller)
+ class_view_paths = TestController.view_paths
+
+ @controller.append_view_path 'foo'
+ assert_equal [LOAD_PATH_ROOT, 'foo'], @controller.view_paths
+
+ @controller.append_view_path(%w(bar baz))
+ assert_equal [LOAD_PATH_ROOT, 'foo', 'bar', 'baz'], @controller.view_paths
+ assert_equal class_view_paths, TestController.view_paths
+ end
+
+ def test_template_prepends_view_path_correctly
+ @controller.instance_variable_set :@template, ActionView::Base.new(TestController.view_paths, {}, @controller)
+ class_view_paths = TestController.view_paths
+
+ @controller.prepend_view_path 'baz'
+ assert_equal ['baz', LOAD_PATH_ROOT], @controller.view_paths
+
+ @controller.prepend_view_path(%w(foo bar))
+ assert_equal ['foo', 'bar', 'baz', LOAD_PATH_ROOT], @controller.view_paths
+ assert_equal class_view_paths, TestController.view_paths
+ end
+
def test_view_paths
get :hello_world
assert_response :success