doesn't work with rspec 2 #7

mackuba opened this Issue Jul 2, 2010 · 13 comments


None yet

6 participants


Getting a deprecation warning:

DEPRECATION WARNING: you are using a deprecated constant that will
be removed from a future version of RSpec.

* Spec is deprecated.
* RSpec is the new top-level module in RSpec-2

And then an error:

/var/lib/hudson/.rvm/gems/ruby-1.9.2-preview3/gems/ci_reporter-1.6.2/lib/ci/reporter/rspec.rb:42:in `<module:Reporter>': uninitialized constant RSpec::Runner (NameError)
        from /var/lib/hudson/.rvm/gems/ruby-1.9.2-preview3/gems/ci_reporter-1.6.2/lib/ci/reporter/rspec.rb:21:in `<module:CI>'
        from /var/lib/hudson/.rvm/gems/ruby-1.9.2-preview3/gems/ci_reporter-1.6.2/lib/ci/reporter/rspec.rb:20:in `<top (required)>'
ci-reporter member

Confirm. Will need to introduce new logic for RSpec 2.


Is there any plan to release a beta compatible with rspec 2 beta? I've seen that netoisstools has changed rspec.rb for rspec 2 compatibility:


does not work with Rails 3.0.0 and RSpec 2.0.0.beta.3 Fails with message :

/home/userX/.rvm/gems/ruby-1.9.2-p0/gems/ci_reporter-1.6.2/lib/ci/reporter/rspec.rb:42:in <module:Reporter>': uninitialized constant RSpec::Runner (NameError)
from /home/userX/.rvm/gems/ruby-1.9.2-p0/gems/ci_reporter-1.6.2/lib/ci/reporter/rspec.rb:21:in
from /home/userX/.rvm/gems/ruby-1.9.2-p0/gems/ci_reporter-1.6.2/lib/ci/reporter/rspec.rb:20:in `'


Here's a diff that makes it work with rspec 2.0. Nick, I'm sure there's a way to integrate this while maintaining backwards compatibility with the old rspec but I haven't looked into that.

diff --git a/lib/ci/reporter/rspec.rb b/lib/ci/reporter/rspec.rb
index e45a67a..aaec487 100644
--- a/lib/ci/reporter/rspec.rb
+++ b/lib/ci/reporter/rspec.rb
@@ -6,8 +6,8 @@ require 'ci/reporter/core'
 tried_gem = false
   require 'spec'
-  require 'spec/runner/formatter/progress_bar_formatter'
-  require 'spec/runner/formatter/specdoc_formatter'
+  require 'spec/core/formatters/progress_formatter'
+  require 'spec/core/formatters/base_formatter'
 rescue LoadError
   unless tried_gem
     tried_gem = true
@@ -39,17 +39,18 @@ module CI

     # Custom +RSpec+ formatter used to hook into the spec runs and capture resu
-    class RSpec < Spec::Runner::Formatter::BaseFormatter
+    class RSpec < Spec::Core::Formatters::BaseFormatter
       attr_accessor :report_manager
       attr_accessor :formatter
       def initialize(*args)
-        @formatter ||=*args)
+        @formatter ||=*args)
         @report_manager ="spec")
         @suite = nil

       def start(spec_count)
+       @start =

@@ -140,7 +141,7 @@ module CI

     class RSpecDoc < RSpec
       def initialize(*args)
-        @formatter =*args)
+        @formatter =*args)

Apparently there's more to this than just fixing the requires and constant names. I haven't been able to get any of the half-dozen or so forks to work properly. Eagerly awaiting official support.


Yes, there were a few more things that needed to be fixed in order to get it running with rspec-rails 2.0.0.beta.19. I created a fork with the changes that work for me.

The fork also includes some fixes from another user running beta22.


Hi Tyler,

I tried your fork but got this error:


Looks like resolves that.

Thanks Tyler, I recommend your fork for anyone else who needs RSpec 2 compatibility.


Great, I'm glad it worked for you John.


Aaaand... it broke again with RSpec 2 RC.

ci/reporter/rspec.rb:42: uninitialized constant RSpec::Core::Formatters (NameError)

Thanks John, I just pushed a fix for rspec2 final.

ci-reporter member

This is fixed in trunk and will go out in 1.6.3.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment