aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2008-01-19 06:01:57 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2008-01-19 06:01:57 +0000
commit88bc014acc82129e55a7ae7505cb62bacd0d685d (patch)
tree855c3779b5eb527ba70ace6901d73242a05be7f0 /actionpack/test
parent16b129a68ca1770815107a3edb54090282349ba7 (diff)
downloadrails-88bc014acc82129e55a7ae7505cb62bacd0d685d.tar.gz
rails-88bc014acc82129e55a7ae7505cb62bacd0d685d.tar.bz2
rails-88bc014acc82129e55a7ae7505cb62bacd0d685d.zip
Revert r8669 for now, breaks Action Mailer. Reopens #10800.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8676 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/controller/mime_responds_test.rb6
-rw-r--r--actionpack/test/controller/new_render_test.rb10
-rw-r--r--actionpack/test/controller/view_paths_test.rb6
-rw-r--r--actionpack/test/template/template_finder_test.rb43
4 files changed, 19 insertions, 46 deletions
diff --git a/actionpack/test/controller/mime_responds_test.rb b/actionpack/test/controller/mime_responds_test.rb
index febdbd0993..ce89b9dbbb 100644
--- a/actionpack/test/controller/mime_responds_test.rb
+++ b/actionpack/test/controller/mime_responds_test.rb
@@ -437,7 +437,11 @@ class MimeControllerTest < Test::Unit::TestCase
end
class AbstractPostController < ActionController::Base
- self.view_paths = File.dirname(__FILE__) + "/../fixtures/post_test/"
+ class << self
+ def view_paths
+ [ File.dirname(__FILE__) + "/../fixtures/post_test/" ]
+ end
+ end
end
# For testing layouts which are set automatically
diff --git a/actionpack/test/controller/new_render_test.rb b/actionpack/test/controller/new_render_test.rb
index 4a9b0e9ddf..eb19b2e391 100644
--- a/actionpack/test/controller/new_render_test.rb
+++ b/actionpack/test/controller/new_render_test.rb
@@ -78,6 +78,11 @@ class NewRenderTestController < ActionController::Base
@secret = 'in the sauce'
render :file => 'test/render_file_with_ivar', :use_full_path => true
end
+
+ def render_file_not_using_full_path_with_relative_path
+ @secret = 'in the sauce'
+ render :file => 'test/../test/render_file_with_ivar', :use_full_path => true
+ end
def render_file_not_using_full_path_with_dot_in_path
@secret = 'in the sauce'
@@ -483,6 +488,11 @@ class NewRenderTest < Test::Unit::TestCase
assert_equal "The secret is in the sauce\n", @response.body
end
+ def test_render_file_not_using_full_path_with_relative_path
+ get :render_file_not_using_full_path_with_relative_path
+ assert_equal "The secret is in the sauce\n", @response.body
+ end
+
def test_render_file_not_using_full_path_with_dot_in_path
get :render_file_not_using_full_path_with_dot_in_path
assert_equal "The secret is in the sauce\n", @response.body
diff --git a/actionpack/test/controller/view_paths_test.rb b/actionpack/test/controller/view_paths_test.rb
index 0516da32d8..b1ca400779 100644
--- a/actionpack/test/controller/view_paths_test.rb
+++ b/actionpack/test/controller/view_paths_test.rb
@@ -16,7 +16,7 @@ class ViewLoadPathsTest < Test::Unit::TestCase
def hello_world_at_request_time() render(:action => 'hello_world') end
private
def add_view_path
- prepend_view_path "#{LOAD_PATH_ROOT}/override"
+ self.class.view_paths.unshift "#{LOAD_PATH_ROOT}/override"
end
end
@@ -27,6 +27,7 @@ class ViewLoadPathsTest < Test::Unit::TestCase
def setup
TestController.view_paths = nil
+ ActionView::Base.cache_template_extensions = false
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
@@ -44,6 +45,7 @@ class ViewLoadPathsTest < Test::Unit::TestCase
def teardown
ActiveSupport::Deprecation.behavior = @old_behavior
+ ActionView::Base.cache_template_extensions = true
end
def test_template_load_path_was_set_correctly
@@ -97,7 +99,7 @@ class ViewLoadPathsTest < Test::Unit::TestCase
end
def test_view_paths_override
- TestController.prepend_view_path "#{LOAD_PATH_ROOT}/override"
+ TestController.view_paths.unshift "#{LOAD_PATH_ROOT}/override"
get :hello_world
assert_response :success
assert_equal "Hello overridden world!", @response.body
diff --git a/actionpack/test/template/template_finder_test.rb b/actionpack/test/template/template_finder_test.rb
deleted file mode 100644
index c1da5be0f4..0000000000
--- a/actionpack/test/template/template_finder_test.rb
+++ /dev/null
@@ -1,43 +0,0 @@
-require 'abstract_unit'
-
-class TemplateFinderTest < Test::Unit::TestCase
-
- LOAD_PATH_ROOT = File.join(File.dirname(__FILE__), '..', 'fixtures')
-
- def setup
- ActionView::TemplateFinder.process_view_paths(LOAD_PATH_ROOT)
- ActionView::Base::register_template_handler :mab, Class.new(ActionView::TemplateHandler)
- @template = ActionView::Base.new
- @finder = ActionView::TemplateFinder.new(@template, LOAD_PATH_ROOT)
- end
-
- def test_should_raise_exception_for_unprocessed_view_path
- assert_raises ActionView::TemplateFinder::InvalidViewPath do
- ActionView::TemplateFinder.new(@template, File.dirname(__FILE__))
- end
- end
-
- def test_should_cache_file_extension_properly
- assert_equal ["builder", "erb", "rhtml", "rjs", "rxml", "mab"].sort,
- ActionView::TemplateFinder.file_extension_cache[LOAD_PATH_ROOT].values.flatten.uniq.sort
-
- assert_equal Dir.glob("#{LOAD_PATH_ROOT}/**/*.{erb,rjs,rjs,builder,rxml,mab}").size,
- ActionView::TemplateFinder.file_extension_cache[LOAD_PATH_ROOT].keys.size
- end
-
- def test_should_cache_dir_content_properly
- assert ActionView::TemplateFinder.processed_view_paths[LOAD_PATH_ROOT]
- assert_equal Dir.glob("#{LOAD_PATH_ROOT}/**/*").find_all {|f| !File.directory?(f) }.size,
- ActionView::TemplateFinder.processed_view_paths[LOAD_PATH_ROOT].size
- end
-
- uses_mocha 'Template finder tests' do
-
- def test_should_update_extension_cache_when_template_handler_is_registered
- ActionView::TemplateFinder.expects(:update_extension_cache_for).with("funky")
- ActionView::Base::register_template_handler :funky, Class.new(ActionView::TemplateHandler)
- end
-
- end
-
-end