Every repository with this icon (
Every repository with this icon (
tree 07397f8f346d13bde1f29ae43b6a1ca7d2268473
parent 1f43691f724a29495be51867d68c3b8a6328bd90
| name | age | message | |
|---|---|---|---|
| |
README.rdoc | Thu May 21 10:57:41 -0700 2009 | |
| |
assets/ | Wed May 20 12:15:01 -0700 2009 | |
| |
bin/ | ||
| |
lib/ | ||
| |
spork.gemspec |
Spork
SYNOPSIS:
Spork is a Drb spec 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 specs. 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.
Because Spork uses Kernel.fork, it only works on POSIX systems. This means Windows users are not invited to this party. Sorry :(
Spork is still experimental, but is performing solid for us.
INSTALL:
[sudo] gem install timcharper-spork --source http://gems.github.com/
alternatively:
git clone git://github.com/timcharper/spork.git cd spork gem build spork.gemspec sudo gem install spork.gemspec
Usage
From a terminal, change to your project directory.
Then, bootstrap your spec/spec_helper.rb file.
spork --bootstrap
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!
spork
To get the TextMate RSpec bundle to use spork, go to config->advanced->shell variables, and add TM_RSPEC_OPTS=—drb.
To run from the command line, use spec —drb spec/lib/my_spec.rb
Or, you could add —drb to your spec.opts file.
Some potential issues and ways to overcome them:
ActiveRecord reports "connection has gone away" for the first few specs
Not sure why this happens, but if you simply add a line to re-establish your database connection on each line as follows, the problem goes away:
Spork.each_run do
ActiveRecord::Base.establish_connection # make sure that the db connection is ready.
end
Couldn’t find formatter class Spec::Runner::Formatter::TextMateFormatter Make sure the —require option is specified before —format
On one of our projects, many of us using TextMate with spork, only one developer got this error message while the rest of us ran just fine. I don’t know exactly why it happened, but requiring the textmate formatter in the prefork block made it go away, like this:
Spork.prefork do
gem "rspec", "= 1.2.6"
require 'spec'
...
require 'spec/runner/formatter/text_mate_formatter'
...
end
Kudos to
- Ben Mabey - help with documentation, testing, suggestions.
- 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.








