sj26/rspec_junit_formatter

0.2.1 causes NameError: uninitialized constant RSpec::Support errors on any rake call

LukevanTricht opened this issue · 5 comments

After updating to version 0.2.1 from version 0.2.0, calling any rake task throws the error below.

rake db:reset --trace

rake aborted!
NameError: uninitialized constant RSpec::Support
~/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/rspec-core-3.2.3/lib/rspec/core/formatters/base_formatter.rb:1:in `<top (required)>'
~/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/rspec_junit_formatter-0.2.1/lib/rspec_junit_formatter.rb:5:in `<top (required)>'
~/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/bundler-1.9.5/lib/bundler/runtime.rb:76:in `require'
~/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/bundler-1.9.5/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
~/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/bundler-1.9.5/lib/bundler/runtime.rb:72:in `each'
~/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/bundler-1.9.5/lib/bundler/runtime.rb:72:in `block in require'
~/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/bundler-1.9.5/lib/bundler/runtime.rb:61:in `each'
~/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/bundler-1.9.5/lib/bundler/runtime.rb:61:in `require'
~/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/bundler-1.9.5/lib/bundler.rb:134:in `require'
~/Desktop/core/config/application.rb:7:in `<top (required)>'
~/.rbenv/versions/2.2.1/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
~/.rbenv/versions/2.2.1/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
~/Desktop/core/Rakefile:4:in `<top (required)>'
~/.rbenv/versions/2.2.1/lib/ruby/2.2.0/rake/rake_module.rb:28:in `load'
~/.rbenv/versions/2.2.1/lib/ruby/2.2.0/rake/rake_module.rb:28:in `load_rakefile'
~/.rbenv/versions/2.2.1/lib/ruby/2.2.0/rake/application.rb:689:in `raw_load_rakefile'
~/.rbenv/versions/2.2.1/lib/ruby/2.2.0/rake/application.rb:94:in `block in load_rakefile'
~/.rbenv/versions/2.2.1/lib/ruby/2.2.0/rake/application.rb:176:in `standard_exception_handling'
~/.rbenv/versions/2.2.1/lib/ruby/2.2.0/rake/application.rb:93:in `load_rakefile'
~/.rbenv/versions/2.2.1/lib/ruby/2.2.0/rake/application.rb:77:in `block in run'
~/.rbenv/versions/2.2.1/lib/ruby/2.2.0/rake/application.rb:176:in `standard_exception_handling'
~/.rbenv/versions/2.2.1/lib/ruby/2.2.0/rake/application.rb:75:in `run'
~/.rbenv/versions/2.2.1/bin/rake:33:in `<main>'
sj26 commented

This seems to be due to weirdness in rspec avoiding using require conventionally. I'll push a fix in a sec.

Workarounds are: add require: false to you bundle, or make sure gem "rspec" is earlier in your Gemfile than gem "rspec_junit_formatter".

sj26 commented

Please try 0.2.2, just released. Reopen if you're still having trouble. Thanks!

May be a different participant, but I'm having trouble that I've isolated to trying to use this formatter. I get these errors, but if I don't use the formatter, it proceeds without error. Any ideas welcome.

Note also I will get this on bundle exec rake spec and rspec

I resolved this myself. The project was one I was not familiar with, and spec_helper had been fiddled with non-trivially. One of the impacts was that .rspec contained --require spec_helper and I was not including that portion of the incantation in my own .rspec file that included this formatting.