My current workaround is to enable perform_caching
then reload the controller:
class ProjectsCachingTest < ActionController::IntegrationTest
def setup
# force the controller to be reloaded when caching is enabled
ActionController::Base.perform_caching = true
load "projects_controller.rb"
end
def teardown
# undo the actions above
ActionController::Base.perform_caching = false
load "projects_controller.rb"
end
end
In the latest version of Rails 2, the issue you are experiencing has to do with the class methods caches_action
and caches_page
. They both create an around filter to do the caching, but only when perform_caching
is enabled.
So, modifying perform_caching
at runtime does not recreate the expected around filters. The example above is one way to force your controller to be re-evaluated.