No commit activity in last 3 years
No release in over 3 years
TODO
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

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 © 2009 Roy Wright. See LICENSE for details.