Phillip Pearson - web + electronics notes

tech notes and web hackery from a new zealander who was vaguely useful on the web back in 2002 (see: python community server, the blogging ecosystem, the new zealand coffee review, the internet topic exchange).


rspec and spec_server

Not immediately obvious when you start using RSpec is that there's a way to get around the huge Rails startup delay. If you've got a spare 80M of memory, you can tell RSpec to load up Rails in the background and hang around until you want to run tests.

rake spec:server:start

Then run your specs like this:

script/spec -X -o spec/spec.opts spec/whatever

The -X tells script/spec to connect to the spec server via DRb and tell it to run the tests, rather than to load up Rails and run the tests itself.

A few runs here show it running about 6 seconds faster with the server, which isn't a big deal over a full test suite but makes a nice difference when focussing on a single spec (1.9 s is much nicer than 8 s).

... more like this: []