Installation
Install
We strongly recommend you install RSpec and Spec::Rails as plugins (as opposed to relying on an RSpec gem). See special instructions below if you want to install the HEAD of the trunk, or an older version.
Installing the CURRENT release
Each time a release is made it will be mirrored in tags/CURRENT, so you can simply point at this to get the latest release. Note that if you do this with -x (svn:externals) you’ll automatically get the latest release when you do an svn up.
ruby script/plugin install http://rspec.rubyforge.org/svn/tags/CURRENT/rspec ruby script/plugin install http://rspec.rubyforge.org/svn/tags/CURRENT/rspec_on_rails
If you’re using svn for your project, install with -x.
ruby script/plugin install -x http://rspec.rubyforge.org/svn/tags/CURRENT/rspec ruby script/plugin install -x http://rspec.rubyforge.org/svn/tags/CURRENT/rspec_on_rails
No SVN?
For those of you working behind a firewall that prohibits svn access:
Go to http://rubyforge.org/frs/?group_id=797, download the latest tarballs and unpack them in vendor/plugins. The directories will have the version numbers in their names, so you’ll need to remove them.
#in vendor/plugins tar zxvf rspec-1.1.3.tgz tar zxvf rspec_on_rails-1.1.3.tgz mv rspec-1.1.3 rspec mv rspec_on_rails-1.1.3 rspec_on_rails
Installing a specific release
ruby script/plugin install http://rspec.rubyforge.org/svn/tags/REL_1_1_3/rspec ruby script/plugin install http://rspec.rubyforge.org/svn/tags/REL_1_1_3/rspec_on_rails
... or (using svn externals) ...
ruby script/plugin install -x http://rspec.rubyforge.org/svn/tags/REL_1_1_3/rspec ruby script/plugin install -x http://rspec.rubyforge.org/svn/tags/REL_1_1_3/rspec_on_rails
Bootstrap
Once the plugin is installed, you must bootstrap your Rails app with RSpec. Stand in the root of your Rails app and run:
ruby script/generate rspec
This will generate the various files needed to use RSpec with Rails.
Run specs with rake …
rake spec
... or run specs with scripts/spec
ruby script/spec spec
Living on the Edge
If you prefer to live dangerously you can get the HEAD of the trunk instead of installing from a tag.
ruby script/plugin install http://rspec.rubyforge.org/svn/trunk/rspec ruby script/plugin install http://rspec.rubyforge.org/svn/trunk/rspec_on_rails
If your own project is in Subversion and you’d like Spec::Rails to always follow HEAD, install with -x:
ruby script/plugin install -x http://rspec.rubyforge.org/svn/trunk/rspec ruby script/plugin install -x http://rspec.rubyforge.org/svn/trunk/rspec_on_rails
Or, if you prefer Piston:
piston import http://rspec.rubyforge.org/svn/trunk/rspec vendor/plugins/rspec piston import http://rspec.rubyforge.org/svn/trunk/rspec_on_rails vendor/plugins/rspec_on_rails
One note about using ‘edge spec’. If you’re choosing to do this, you probably like to use edge rails as well. If you do this, you have chosen to work with two moving targets, which is nuts. We do it too, so you’re not alone. But please don’t expect that edge spec is always going to support the latest changes in edge rails. And when it doesn’t, a patch would be just lovely!
Releases 0.8.x to 0.9.x (not really recommended at this point)
ruby script/plugin install http://rspec.rubyforge.org/svn/tags/REL_X_Y_Z/rspec ruby script/plugin install http://rspec.rubyforge.org/svn/tags/REL_X_Y_Z/rspec_on_rails/vendor/plugins/rspec_on_rails
Releases < 0.7.5 (REALLY NOT recommended at this point)
ruby script/plugin install http://rspec.rubyforge.org/svn/tags/REL_X_Y_Z/rspec ruby script/plugin install http://rspec.rubyforge.org/svn/tags/REL_X_Y_Z/vendor/rspec_on_rails/vendor/plugins/rspec_on_rails
