RSpec tasks on Rails 3

RSpec tasks on Rails 3
Photo by Christopher Gower / Unsplash

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'

Read more