diff options
author | Neeraj Singh <neerajdotname@gmail.com> | 2010-12-04 17:40:54 -0500 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-12-09 16:14:57 +0100 |
commit | 0027b654215cd6310d0d17daeaafec8ebbfb38d4 (patch) | |
tree | 6a15b97f4e9a04f01b516fcab0e6dae48ba0c7f9 /actionpack/test | |
parent | cc48192248f107c61294f72459fd027d45403ba5 (diff) | |
download | rails-0027b654215cd6310d0d17daeaafec8ebbfb38d4.tar.gz rails-0027b654215cd6310d0d17daeaafec8ebbfb38d4.tar.bz2 rails-0027b654215cd6310d0d17daeaafec8ebbfb38d4.zip |
Ensure that while caching a page rails takes into
account the resolved mime type for the request
[#6110 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/controller/caching_test.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/actionpack/test/controller/caching_test.rb b/actionpack/test/controller/caching_test.rb index 914ae56032..c7b54eb0ba 100644 --- a/actionpack/test/controller/caching_test.rb +++ b/actionpack/test/controller/caching_test.rb @@ -16,6 +16,7 @@ end class PageCachingTestController < CachingController caches_page :ok, :no_content, :if => Proc.new { |c| !c.request.format.json? } caches_page :found, :not_found + caches_page :about_me def ok @@ -47,6 +48,14 @@ class PageCachingTestController < CachingController def trailing_slash render :text => "Sneak attack" end + + def about_me + respond_to do |format| + format.html {render :text => 'I am html'} + format.xml {render :text => 'I am xml'} + end + end + end class PageCachingTest < ActionController::TestCase @@ -111,6 +120,13 @@ class PageCachingTest < ActionController::TestCase assert File.exist?("#{FILE_STORE_PATH}/page_caching_test/trailing_slash.html") end + def test_should_obey_http_accept_attribute + @request.env['HTTP_ACCEPT'] = 'text/xml' + get :about_me + assert File.exist?("#{FILE_STORE_PATH}/page_caching_test/about_me.xml") + assert_equal 'I am xml', @response.body + end + def test_should_cache_with_trailing_slash_on_url @controller.class.cache_page 'cached content', '/page_caching_test/trailing_slash/' assert File.exist?("#{FILE_STORE_PATH}/page_caching_test/trailing_slash.html") |