Upgrading the RSpec gem

gem install rspec

Upgrading Spec::Rails

If you’re upgrading Spec::Rails in an existing application, you should do the following. Note that the last step will try to replace spec/spec.opts and spec/spec_helper.rb. If you have modified those files you’ll want to save them aside in advance and then merge in your modifications.

# from the root of your rails project
rm -rf vendor/plugins/rspec
rm -rf vendor/plugins/rspec_on_rails
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
ruby script/generate rspec

WARNING: Depending on the last time you upgraded, there may be a call to an experimental method named raise_controller_errors in spec_helper.rb. As long as you follow the upgrade instructions above, this will be removed, however if you skip the last step (ruby script/generate rspec), then you’ll need to manually remove this from spec_helper.rb.

Upgrading from RSpec 0.8.x or earlier

In order to ease the transition from 0.8 style specs to the current style (introduced in 0.9), we have included a translator to automate this translation.

The translator is not perfect, but we feel it’s “good enough”. It will translate roughly 95% or more of your specs correctly, and you should expect some manual work. Make sure all of your examples are green before you run it!

After installing the gem, you should run:

spec_translator path_to_my_spec_dir path_to_my_translated_spec_dir

(or alternatively, if you have your code under version control and can do a revert if things go wrong:)

spec_translator path_to_my_spec_dir path_to_my_spec_dir

(This will translate your specs in-place)

For convenience, we have also made the translator available as a Rake task in Spec::Rails

rake spec:translate