Rspec

Installation Steps

If you're not going to use another testing framework such as Test::Unit or Shoulda, you can remove the "test" directory in the RAILS_ROOT folder to avoid clutter. Also remember to use rspec generators instead of the default ones:

script/generate rspec_model
script/generate rspec_controller
...

Step 1
Put this in your config/environments/test.rb

config.gem "rspec", :version => '1.3.0',
                    :lib => 'spec'

config.gem "rspec-rails", :version => '1.3.2',
                    :lib => false

Step 2
Then install it:

sudo rake gems:install
rake gems:unpack GEM=rspec RAILS_ENV=test
rake gems:unpack GEM=rspec-rails RAILS_ENV=test

Step 3
Generate raketasks and spec folder:

ruby script/generate rspec

And that's it! Start having fun with BDD.

Integrating with Autotest

See autotest.

Documentation and Examples

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License