manage test fixtures by keep them updated and accurate
Clone or download
Latest commit 29b8fc1 Feb 17, 2012
Failed to load latest commit information.
lib 0.5.2, 0.5.1 was bad Feb 17, 2012
spec support rails 3+ Feb 17, 2012
.gitignore basic release Jun 26, 2009
Gemfile support rails 3+ Feb 17, 2012
Gemfile.lock 0.5.2, 0.5.1 was bad Feb 17, 2012
LICENSE yaml syntax checking and loader completed. Jun 26, 2009
README.rdoc their typo Mar 23, 2010
Rakefile add bundler tasks Feb 17, 2012
VERSION 0.5.2, 0.5.1 was bad Feb 17, 2012
stale_fish.gemspec 0.5.2, 0.5.1 was bad Feb 17, 2012


Stale Fish

StaleFish is a utility for storing web requests as fixtures, faking web requests, and ensuring fixtures stay fresh by checking request at periodic intervals. It works at a global level, without modifying code or writing extensive stubs.


1.3.x is a complete rewrite of the StaleFish utility. It is incompatible with previous versions of StaleFish.


  • Manage FakeWeb through StaleFish

  • Fixtures are updated based on a per-fixture update interval

  • Fixture update interval supports the ActiveSupport relative time DSL (ex. '30.minutes', '2.days', '1.year')

  • Configuration file and fixture data is version control friendly

  • Specify which fixtures are checked for freshness using :all, :only, & :except arguement options

  • Force update of all fixtures regardless of freshness (bypass freshness check)

  • Test Framework agnostic (tested with Test::Unit & RSpec)

How To

Simply drop in a YAML file in your application (recommended location: {test/spec}/fixtures/stale_fish.yml) and issue the following commands.

A sample YAML file:

--- !omap
- stale:
  - twitter:                                        # fixture name (this must be unique)
    file: 'timeline.json'                           # fixture save location
    update_interval: 30.days                        # update interval
    check_against:  # data to update fixture with when stale
    request_type: POST                              # request type to use when updating: GET, POST
    update_method: StaleFishFixture.update_me       # optional: this method is evaluated for a response instead of hitting the check_against param
    last_updated_at:                                # timestamp of last fixture update (can be left blank)
  - gh_commits:
    file: 'commits.xml'
    update_interval: 3.days
    request_type: GET

Specify one block for every fixture you would like to update. The frequency field takes any relative date included in the ActiveSupport library.


For a single test add it to a before block

describe UsersController do
  before do

For all tests add the following to spec_helper.rb

require 'stale_fish'

Spec::Runner.configure do |config|
  config.before :suite do


For all tests add the following to test_helper.rb

class Test::Unit::TestCase
  setup do

More Info

View the wiki:


This utility uses FakeWeb, thanks to those contributors for their excellent work.


Copyright © 2009-2010 Justin Smestad. See LICENSE for details.