I've cleaned up and released as a plugin some code I use to both manipulate the cache outside a request, and to test pages and fragments have been cached/expired as expected. You can get it from:
http://svn.popdog.net/plugins/caching_extras/tags/REL-0.1/
The first feature it provides is standalone access to the fragment and page cache. This can be useful if (like me) you have external ruby processes that import data, and then need to expire fragments or pages. Usage is pretty simple:
class ReportCacheManager include Popdog::Caching::Standalone
def expire_salary_report [:xml, :xls, :html].each do |format| expire_page :controller => 'report', :action => 'salary', :format => format end end end
The other feature it provides are caching assertions, similar to those Damien Merenne has made available in his plugin: http://blog.cosinux.org/pages/page-cache-test
The implementation is slightly different though. Rather than mocking out replacing the caches with temporary versions for the duration of the assertions. It makes use of the standalone access module, so should work within unit, functional and integration tests.
Please let me know if you have any questions/problems/ideas for enhancement. I'm only just starting to use it in anger now, so there's likely to be much room for improvement.
Tom