[rspec-users] Upgrade problems/questions regarding RSpec 1.3.0 to 2.0.1

Jarmo Pertman jarmo.p at gmail.com
Thu Nov 4 16:37:33 EDT 2010

There seems to be also a problem when using RCov raketask - it doesn't
seem to load RSpec.

Consider the following project structure:

# Rakefile
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec) do |spec|

RSpec::Core::RakeTask.new(:rcov) do |spec|
  spec.rcov = true

# lib/my_lib.rb
class MyLib

# spec/my_lib_spec.rb
require "lib/my_lib"

describe "should work" do
  it "doesn't" do
    MyLib.new.should be

Now, when executing `rake spec` everything works - RSpec itself gets
loaded automatically. When executing `rake rcov` on the other hand
then this will be the output:

C:\Users\jarmo\Desktop\minu\projects\Ruby\blah>rake rcov
(in C:/Users/jarmo/Desktop/minu/projects/Ruby/blah)
c:/ruby/bin/ruby.exe -S rcov -Ispec "./spec/my_lib_spec.rb"
./spec/my_lib_spec.rb:1: undefined method `describe' for main:Object
        from c:/ruby/lib/ruby/gems/1.8/gems/rcov-0.9.8/bin/rcov:511:in
        from c:/ruby/lib/ruby/gems/1.8/gems/rcov-0.9.8/bin/rcov:511
        from c:/ruby/bin/rcov:19:in `load'
        from c:/ruby/bin/rcov:19
rake aborted!
ruby -S rcov -Ispec "./spec/my_lib_spec.rb" failed

It will pass of course if i'll add `require "rspec"` to somewhere.

Jarmo Pertman
IT does really matter - http://www.itreallymatters.net

More information about the rspec-users mailing list