Sha256: 7e442225b0cd87dfa67fb5db388d27ecd12a057acb96e46f1b683d182b659386
Contents?: true
Size: 1.18 KB
Versions: 2
Compression:
Stored size: 1.18 KB
Contents
= read_page_cache == Synopsis The purpose of the module is to cache web pages used for testing by overriding the classes' read_page method and replacing it with one that will cache pages. == Usage Your main code needs to have a read_page(page) instance method(s). Here's an example: class ClassName def read_page(page) open(page).read end end Then your test code should include: # default directory is '/tmp' directory = '/path/to/cache/files' require 'cache_extensions' ReadPageCache.attach_to ClassName, directory You may attach_to however many classes that you need to. If you want to override all the read_page(page) methods in your application, then your test code can instead use: # default directory is '/tmp' directory = '/path/to/cache/files' require 'cache_extensions' ReadPageCache.attach_to_classes directory That's it. The first time you run your tests, the web pages your application accesses with read_page will be cached, then the cached files will be used by all subsequent accesses. You may want to review the cache and add any files you want to your version control system. == Copyright Copyright (c) 2009 Roy Wright. See LICENSE for details.
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
royw-read_page_cache-0.0.1 | README.rdoc |
royw-read_page_cache-0.0.2 | README.rdoc |