Migrating to RSpec 2 from RSpec 1

Updated . Posted . Visible to the public.

You will need to upgrade to RSpec >= 2 and rspec-rails >= 2 for Rails 3. Here are some hints to get started:

  • In RSpec 2 the executable is rspec, not spec.
  • RSpec and rspec-rails have been completely refactored internally. All RSpec classes have been renamed from Spec::Something to RSpec::Something. This also means that every require 'spec/something' must now be require 'rspec/something'.
  • In spec_helper.rb, Spec::Runner.configure becomes RSpec.configure
  • It has become really hard to extend specific example groups in rspec-rails (e.g. only controller example groups). Your existing example macros will probably break for this reason. Save yourself the trouble and attach all your macros to RSpec::Core::ExampleGroup instead.
  • Your spec_candy.rb will break. We have a working update in the repository "why", branch "rails3". We will update the note soon.
  • rspec_spinner does not yet work with RSpec 2. We will update the gem soon.
Henning Koch
Last edit
License
Source code in this card is licensed under the MIT License.
Posted by Henning Koch to makandra dev (2010-10-22 17:46)