From 0ea434e2f4083368fe9657aae9ceb5c484336f14 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino and Carl Lerche Date: Thu, 15 Apr 2010 16:58:54 -0300 Subject: Make perform_caching work again, with the tests passing and backward compatible --- actionpack/test/controller/caching_test.rb | 20 ++++++++++---------- actionpack/test/controller/log_subscriber_test.rb | 8 ++++---- 2 files changed, 14 insertions(+), 14 deletions(-) (limited to 'actionpack/test/controller') diff --git a/actionpack/test/controller/caching_test.rb b/actionpack/test/controller/caching_test.rb index 217260fdcd..115cc91467 100644 --- a/actionpack/test/controller/caching_test.rb +++ b/actionpack/test/controller/caching_test.rb @@ -53,16 +53,16 @@ class PageCachingTest < ActionController::TestCase def setup super - ActionController::Base.perform_caching = true - @request = ActionController::TestRequest.new @request.host = 'hostname.com' @request.env.delete('PATH_INFO') - @response = ActionController::TestResponse.new @controller = PageCachingTestController.new + @controller.perform_caching = true @controller.cache_store = :file_store, FILE_STORE_PATH + @response = ActionController::TestResponse.new + @params = {:controller => 'posts', :action => 'index', :only_path => true} FileUtils.rm_rf(File.dirname(FILE_STORE_PATH)) @@ -71,7 +71,7 @@ class PageCachingTest < ActionController::TestCase def teardown FileUtils.rm_rf(File.dirname(FILE_STORE_PATH)) - ActionController::Base.perform_caching = false + @controller.perform_caching = false end def test_page_caching_resources_saves_to_correct_path_with_extension_even_if_default_route @@ -538,9 +538,9 @@ end class FragmentCachingTest < ActionController::TestCase def setup super - ActionController::Base.perform_caching = true @store = ActiveSupport::Cache::MemoryStore.new @controller = FragmentCachingTestController.new + @controller.perform_caching = true @controller.cache_store = @store @params = {:controller => 'posts', :action => 'index'} @request = ActionController::TestRequest.new @@ -564,7 +564,7 @@ class FragmentCachingTest < ActionController::TestCase end def test_read_fragment_with_caching_disabled - ActionController::Base.perform_caching = false + @controller.perform_caching = false @store.write('views/name', 'value') assert_nil @controller.read_fragment('name') end @@ -576,7 +576,7 @@ class FragmentCachingTest < ActionController::TestCase end def test_fragment_exist_with_caching_disabled - ActionController::Base.perform_caching = false + @controller.perform_caching = false @store.write('views/name', 'value') assert !@controller.fragment_exist?('name') assert !@controller.fragment_exist?('other_name') @@ -590,7 +590,7 @@ class FragmentCachingTest < ActionController::TestCase def test_write_fragment_with_caching_disabled assert_nil @store.read('views/name') - ActionController::Base.perform_caching = false + @controller.perform_caching = false assert_equal 'value', @controller.write_fragment('name', 'value') assert_nil @store.read('views/name') end @@ -614,7 +614,7 @@ class FragmentCachingTest < ActionController::TestCase end def test_fragment_for_with_disabled_caching - ActionController::Base.perform_caching = false + @controller.perform_caching = false @store.write('views/expensive', 'fragment content') fragment_computed = false @@ -688,9 +688,9 @@ end class FunctionalFragmentCachingTest < ActionController::TestCase def setup super - ActionController::Base.perform_caching = true @store = ActiveSupport::Cache::MemoryStore.new @controller = FunctionalCachingController.new + @controller.perform_caching = true @controller.cache_store = @store @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new diff --git a/actionpack/test/controller/log_subscriber_test.rb b/actionpack/test/controller/log_subscriber_test.rb index 20d3e77b6e..b11eba2f89 100644 --- a/actionpack/test/controller/log_subscriber_test.rb +++ b/actionpack/test/controller/log_subscriber_test.rb @@ -143,7 +143,7 @@ class ACLogSubscriberTest < ActionController::TestCase end def test_with_fragment_cache - ActionController::Base.perform_caching = true + @controller.config.perform_caching = true get :with_fragment_cache wait @@ -151,11 +151,11 @@ class ACLogSubscriberTest < ActionController::TestCase assert_match /Exist fragment\? views\/foo/, logs[1] assert_match /Write fragment views\/foo/, logs[2] ensure - ActionController::Base.perform_caching = true + @controller.config.perform_caching = true end def test_with_page_cache - ActionController::Base.perform_caching = true + @controller.config.perform_caching = true get :with_page_cache wait @@ -163,7 +163,7 @@ class ACLogSubscriberTest < ActionController::TestCase assert_match /Write page/, logs[1] assert_match /\/index\.html/, logs[1] ensure - ActionController::Base.perform_caching = true + @controller.config.perform_caching = true end def logs -- cgit v1.2.3