grosser / rspec-instafail

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

When installed as plugin, lib is not in load-path #3

Closed zquestz closed 13 years ago

zquestz commented 13 years ago

The require statements in instafail.rb didn't work with my company's spec setup. I just made the require lines less error prone. There is no downside.

zquestz commented 13 years ago

Usually I don't have this issue, might be because we use jruby in house. I kept hitting the following error when running "spec spec"

/vendor/plugins/rspec-instafail/lib/rspec/instafail.rb:5:in `require': no such file to load -- rspec/instafail/rspec_1 (LoadError)

When I made sure the require was absolute, the issue went away.

grosser commented 13 years ago

I think thats kind of hacky, somehow the lib folder is not in the load-path, making everything absolute only fixes the symptom imo. Ill try to reproduce this and see if there a better fix. Which rails are you using / which command to .rspec config ?

zquestz commented 13 years ago

We are using jruby with rails 2.2.x, I do my spec runs with "jruby -S spec spec".

zquestz commented 13 years ago

K, here's a bit more info, here is my $LOAD_PATH, I edited the instafail.rb file to dump it out with the following snippet.

puts "LOAD PATH #{$LOAD_PATH.inspect}" begin require 'rspec/instafail/rspec_2' rescue LoadError # try rspec 1 require 'rspec/instafail/rspec_1' end

Output was: LOAD PATH ["/Users/quest/.rvm/gems/jruby-1.5.1@involver/gems/rspec-1.3.0/bin", "/Users/quest/.rvm/gems/jruby-1.5.1@involver/gems/rspec-1.3.0/lib", "/Users/quest/.rvm/rubies/jruby-1.5.1/lib/ruby/site_ruby/1.8", "/Users/quest/.rvm/rubies/jruby-1.5.1/lib/ruby/site_ruby/shared", "/Users/quest/.rvm/rubies/jruby-1.5.1/lib/ruby/1.8", "."]

It seems the plugin's lib directory was not added to my $LOAD_PATH... Still investigating but will post more info as I come across it.

grosser commented 13 years ago

merged it into 0.1.6, if you find a better fix for it/it can e removed please let me know! cheers mg

grosser commented 12 years ago

I think it is because rspec 2 does not add plugin load paths before running, the fix I use in parallel_tests is -I vendor/plugins/parallel_tests/lib --format ....