Skip to content
manage test fixtures by keep them updated and accurate
Find file
Latest commit 29b8fc1 @jsmestad 0.5.2, 0.5.1 was bad
Failed to load latest commit information.
lib 0.5.2, 0.5.1 was bad
spec support rails 3+
.gitignore basic release
Gemfile support rails 3+
Gemfile.lock 0.5.2, 0.5.1 was bad
LICENSE yaml syntax checking and loader completed.
README.rdoc their typo
Rakefile add bundler tasks
VERSION 0.5.2, 0.5.1 was bad
stale_fish.gemspec 0.5.2, 0.5.1 was bad


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.

Something went wrong with that request. Please try again.