grosser / rspec-instafail

Show failing specs instantly
MIT License
283 stars 34 forks source link

Fix issue loading with rspec 3.4.0 #25

Closed cburgmer closed 8 years ago

cburgmer commented 8 years ago

When upgrading rspec from 3.1.0 to 3.4.0 I receive the following stacktrace running rspec:

NoMethodError: undefined method `version' for nil:NilClass
                 RSpec at /tmp/.gem/jruby/1.9/gems/rspec-instafail-0.4.0/lib/rspec/instafail.rb:3
                (root) at /tmp/.gem/jruby/1.9/gems/rspec-instafail-0.4.0/lib/rspec/instafail.rb:1
               require at org/jruby/RubyKernel.java:1071
                (root) at /tmp/jruby/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:1
               require at /tmp/jruby/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:128
                  each at org/jruby/RubyArray.java:1613
             requires= at /tmp/jruby/lib/ruby/gems/shared/gems/rspec-core-3.4.4/lib/rspec/core/configuration.rb:1295
             requires= at /tmp/jruby/lib/ruby/gems/shared/gems/rspec-core-3.4.4/lib/rspec/core/configuration.rb:1295
                  each at org/jruby/RubyArray.java:1613
  process_options_into at /tmp/jruby/lib/ruby/gems/shared/gems/rspec-core-3.4.4/lib/rspec/core/configuration_options.rb:109
  process_options_into at /tmp/jruby/lib/ruby/gems/shared/gems/rspec-core-3.4.4/lib/rspec/core/configuration_options.rb:108
             configure at /tmp/jruby/lib/ruby/gems/shared/gems/rspec-core-3.4.4/lib/rspec/core/configuration_options.rb:21
                 setup at /tmp/jruby/lib/ruby/gems/shared/gems/rspec-core-3.4.4/lib/rspec/core/runner.rb:105
                   run at /tmp/jruby/lib/ruby/gems/shared/gems/rspec-core-3.4.4/lib/rspec/core/runner.rb:92
                   run at /tmp/jruby/lib/ruby/gems/shared/gems/rspec-core-3.4.4/lib/rspec/core/runner.rb:78
                invoke at /tmp/jruby/lib/ruby/gems/shared/gems/rspec-core-3.4.4/lib/rspec/core/runner.rb:45
                  load at org/jruby/RubyKernel.java:1087
                (root) at /tmp/jruby/lib/ruby/gems/shared/gems/rspec-core-3.4.4/exe/rspec:4

The proposed change fixes that issue for me.

grosser commented 8 years ago

so rspec is not installed ? ... how can rspec-core be there and rspec is not ?

grosser commented 8 years ago

bundle exec rspec spec/ --fail-fast

or

# spec/spec_helper.rb
RSpec.configure do |c|
  c.fail_fast = true
end
grosser commented 8 years ago

basically this gem is obsolete and should not be used ...

cburgmer commented 8 years ago

--fail-fast will not run all other tests after a failure, while this gem does, a benefit to me.

I might be doing this wrong (and I don't have any clue about Ruby gem resolution), but my project references some rspec dependencies (though not directly rspec). I have instafail installed globally.

If I run bundle exec rspec things seem to work fine, whereas just rspec will produce above error.

I am running JRuby on Windows.

Happy to have bundle exec as a solution for me, but also wouldn't mind understanding why an upgrade to rspec stopped working. Feel free to close this.

grosser commented 8 years ago

I'd think you should add rspec to the Gemfile ... not sure why it works without ... but I guess changing to rspec-core is fine too ...

cburgmer commented 8 years ago

Sorry, actually I can't run bundle exec together with a user install of instafail. I am assuming that bundle doesn't cover this. I could add the gem to the project's Gemspec, but not everybody is using it and it feels like polluting the team deps.

Given that I skip bundle exec, if I do a puts Gem.loaded_specs I only receive a hash with rspec-support, rspec-core and rspec-instafail, although I also have rspec-3.4.0 installed alongside instafail.

grosser commented 8 years ago

so I guess it works because you are not using bundler ... funky ...

grosser commented 8 years ago

0.5.0 ... this might bite a few people stuck on rspec1 ... but let's see :D

cburgmer commented 8 years ago

Thanks, works like a charm