RSpec tasks on Rails 3

September 25, 2010

Problem: uninitialized constant RSpec::Rake

Solution:

You are using rails 3 (and rspec 2), and trying to define a custom rake task with Spec::Rake::SpecTask.new

Instead, do:

RSpec::Core::RakeTask.new(:spec) do |t|
...

and make sure to change:

t.spec_files = FileList['spec/**/*_spec.rb']

to

t.pattern   = 'spec/**/*_spec.rb'