Upgrading your Rakefile from RSpec 1.3 to RSpec 2

October 26, 2010 Alex Chaffee

I’m updating Erector to RSpec 2 and came across two problems for which solutions were surprisingly difficult to Google. Here are my (finally successful) results.


Problem:

no such file to load -- spec/rake/spectask

Before:

require "spec/rake/spectask"  # RSpec 1.3

After:

require "rspec/core/rake_task" # RSpec 2.0

Problem:

undefined method `spec_files=' for #<RSpec::Core::RakeTask:0x00000101550aa8>

Before:

# RSpec 1.3
Spec::Rake::SpecTask.new(:core) do |spec|
  spec.spec_files = FileList['spec/erector/*_spec.rb']
  spec.spec_opts = ['--backtrace']
end

After:

# RSpec 2.0
RSpec::Core::RakeTask.new(:core) do |spec|
  spec.pattern = 'spec/erector/*_spec.rb'
  spec.rspec_opts = ['--backtrace']
end

See also http://github.com/rspec/rspec-core/blob/master/Upgrade.markdown (curiously cloaked from Google searches for the above problem strings).

About the Author

Biography

More Content by Alex Chaffee
Previous
Open Source Development Workshop — Thursday, October 28 at 6:30PM
Open Source Development Workshop — Thursday, October 28 at 6:30PM

Open Source Development Workshop Thursday, October 28 at 6:30PM Pivotal Labs is hosting and our own Sarah...

Next
Rails 3 with RVM and Cruise Control
Rails 3 with RVM and Cruise Control

Here are a few notes on how to get individual CruiseControl.rb project Builders running with RVM. [Note: I...

Enter curious. Exit smarter.

Register Now