Every repository with this icon (
Every repository with this icon (
spork + autospec == pure bdd joy
There is little joy in waiting around for rails to load up every time you want to run your code examples, and there is equally less joy in having to run them manually between each change.
The remedy is a combination of two companion tools: autospec and spork.
Autospec
The autospec script that ships with rspec is a really, really thin wrapper for autotest, which ships with the ZenTest suite. With the autospec wrapper, autotest watches your app, lib and spec directories for any changes and re-runs your specs every time you make a change. If all the specs are passing, it only runs the relevant spec.
Autospec depends on ZenTest and autotest-rails (for ZenTest >= 4.1).
gem install ZenTest autotest-rails
Spork
Spork lets you run your specs in a server that is already running via DRb.
1. Install spork
gem install spork
2. Bootstrap your Rails app
cd /path/to/project/root
spork --bootstrap
3. Modify spec/spec_helper.rb
The spork --bootstrap command adds some instructions and code to spec/spec_helper.rb. Open up that file and follow the instructions.
4. Modify spec/spec.opts
Add --drb to spec/spec.opts
5. Fire up spork
spork rspec
6. Run your specs
autospec
7. Write some specs and code!!!!
Warnings
- this does not work with view specs for rails versions < 2.3
- you may need to restart autospec when adding new files
- you may need to restart autospec and spork after migrations






