diff options
author | Marcel Molina <marcel@vernix.org> | 2006-10-12 23:29:04 +0000 |
---|---|---|
committer | Marcel Molina <marcel@vernix.org> | 2006-10-12 23:29:04 +0000 |
commit | 065908a4c59f949c49abb97a9483ef16d02ec329 (patch) | |
tree | 45517cfa078f558ecb2abc819b02d5a60e74cf20 /actionpack/test/controller | |
parent | 41c362352433f265a95c00d8e7b5c1f1299e9011 (diff) | |
download | rails-065908a4c59f949c49abb97a9483ef16d02ec329.tar.gz rails-065908a4c59f949c49abb97a9483ef16d02ec329.tar.bz2 rails-065908a4c59f949c49abb97a9483ef16d02ec329.zip |
Make page caching respect the format of the resource that is being requested even if the current route is the default route so that, e.g. posts.rss is not transformed by url_for to '/' and subsequently cached as '/index.html' when it should be cached as '/posts.rss'.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5289 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r-- | actionpack/test/controller/caching_test.rb (renamed from actionpack/test/controller/action_caching_test.rb) | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/actionpack/test/controller/action_caching_test.rb b/actionpack/test/controller/caching_test.rb index 21c11ed417..1935cf5aa5 100644 --- a/actionpack/test/controller/action_caching_test.rb +++ b/actionpack/test/controller/caching_test.rb @@ -7,6 +7,27 @@ FILE_STORE_PATH = File.join(File.dirname(__FILE__), '/../temp/', CACHE_DIR) ActionController::Base.perform_caching = true ActionController::Base.fragment_cache_store = :file_store, FILE_STORE_PATH +class PageCachingTest < Test::Unit::TestCase + def setup + ActionController::Routing::Routes.draw do |map| + map.main '', :controller => 'posts' + map.resources :posts + map.connect ':controller/:action/:id' + end + + @request = ActionController::TestRequest.new + @params = {:controller => 'posts', :action => 'index', :only_path => true, :skip_relative_url_root => true} + @rewriter = ActionController::UrlRewriter.new(@request, @params) + end + + def test_page_caching_resources_saves_to_correct_path_with_extension_even_if_default_route + @params[:format] = 'rss' + assert_equal '/posts.rss', @rewriter.rewrite(@params) + @params[:format] = nil + assert_equal '/', @rewriter.rewrite(@params) + end +end + class ActionCachingTestController < ActionController::Base caches_action :index |