Adding rspec to a new rails project
There aren’t as many quick guides to using rspec as there should be. So, to help anyone wanting a fast jumpstart, here’s how to add rspec to a new project:
$ ./script/plugin install git://github.com/dchelimsky/rspec.git
$ ./script/plugin install git://github.com/dchelimsky/rspec-rails.git
$ ./script/generate rspec
That’s all there is to it! You can run your rspec tests with this command:
$ rake spec
.. or, with code coverage output:
$ rake spec:rcov
$ open coverage/index.html
Now you’re ready to write some tests. To get started, take a look at the examples at http://rspec.info/documentation/rails/