Mailing list: groups.google.com/group/sporkgem
Spork is Tim Harper's implementation of test server (similar to the script/spec_server provided by rspec-rails), except rather than using the Rails constant unloading to reload your files, it forks a copy of the server each time you run your tests. The result? Spork runs more solid: it doesn't get corrupted over time, and it properly handles modules and any voo-doo meta programming you may have put in your app.
Spork runs on POSIX systems using fork. It also runs on windows by pre-populating a pool of ready processes (referred to here as the “magazine” strategy).
Rails 3.0 support is in progress, but is not ready. The master branch is stable and works with rails 2.3.x.
Rspec 2.x support is not ready either.
If you want to help, see the rails3 branch.
Supported Testing Frameworks
Test::Unit (via 'gem install spork-testunit')
And more to come! Vote for your favorite at github.com/timcharper/spork/issues
Supported Application Frameworks
Actually, Spork ~can~ work with any application framework. But, it ships with hooks and helpers to help make the experience much more “out of the box”
More can be added! Vote for your favorite at github.com/timcharper/spork/issues
[sudo] gem install spork
git clone git://github.com/timcharper/spork.git cd spork gem build spork.gemspec sudo gem install spork.gemspec
From a terminal, change to your project directory.
Then, bootstrap your spec/spec_helper.rb file.
Next, edit spec/spec_helper.rb and follow the instructions that were put at the top.
Finally, run spork. A spec DRb server will be running!
Initially, you may find that a few files don't reload automatically. This is because they are being loaded during Spork startup. To identify which project files are being pre-loaded, and why, run:
spork --diagnose (or spork -d, for short)
It will output a lot of stuff. At the top you'll find a summary of all project files loaded. Down below, the stack trace for each file (how it got loaded). Spork hooks into Rails and does some magic (TM) to prevent ApplicationController observers, etc from pre-loading. Similar hooks for other ruby frameworks may come as support demands.
Running specs over Spork
To get the TextMate RSpec bundle to use spork, go to config->advanced->shell variables, and add:
To run from the command line, use:
spec --drb spec/lib/my_spec.rb
Or, you could add the following flag to your spec.opts file.
Cucumber has DRb support (see wiki.github.com/aslakhellesoy/cucumber/spork-and-drb )
Use this as a guideline when “Sporking” your features/support/env.rb file
Running the Spork test suite
If you wish to hack on spork, you will want to run the automated test suite to make sure your changes don't break anything. Spork uses bundler to manage and install dependencies. To start:
Then, to run the specs:
bundle exec spec spec/
bundle exec rake
running features ===
Basically, like this:
bundle exec cucumber features
If you wish to test with another Gemfile:
GEMFILE=rails2.3 bundle exec cucumber features
Where rails2.3 is one of support/gemfiles/* (rails2.3 is the default)
Some potential issues and ways to overcome them:
Ben Mabey - help with documentation, testing, suggestions, patches, and bringing Cucumber support.
David Chelimsky - for the fine RSpec testing framework, and the original rspec-rails spec_server implementation, which Spork has built upon.
Lead Media Partners - just for being an awesome place to work.
Spork © 2009 Tim Harper, released under the MIT license