This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
In a Ruby on Rails project using Rspec right-clicking a failed Rspec test gives the option to "Run Again" but choosing that option does nothing. This occurs both at the test level and the describe level. No matter what I try I must run all tests over again.
Thanks for the report. I can reproduce the problem when using JRuby, can you please confirm whether you also experience this with JRuby only? I'll commit a fix for this soon.
Fixed for the JRuby case in d7696fcb37f3. Please reopen if you ran into this problem when not using JRuby - thanks.
None of my project use JRuby, rather my projects use Ruby 1.8.6-p111
OK, thanks for the info - must be a different issue then. Which RSpec version do you use? Also, can you please turn on detailed logging (http://wiki.netbeans.org/FaqRubyNBLogging67), reproduce the problem and attach the log file here then.
We have rspec-1.2.9 and rspec-rails-1.2.7.1 both installed as frozen gems in our Rails app. It may be important to note that we use the rspec gem(s) and not plugin(s), as that may make a difference with how NetBeans handles things (I dunno). I will try to get back to you within the hour with the detailed log you requested.
Created attachment 90731 [details] detailed log that was requested A couple of things to note: 1. I could not find the log file anywhere in my NB install directory or any subfolders so I ended up copying the contents from Menu | View | IDE Log File 2. When I click on "Run Again" nothing seems to be appended to the log. I tried clicking it multiple times, but every time I checked the log there had been nothing added to it.
A couple of things to note: 1. I could not find the log anywhere in my NB install directory or any subfolders so I ended up copying the contents of Menu | View | IDE Log File 2. It seems that nothing is appended to the log when I click "Run Again" I tried clicking it multiple times and there was never anything added to the end of the log.
Thanks for the log. Looks like I'll need to add some more logging, but I'll first try whether I can reproduce this with the same configuration that you have.
After looking at the log in more details, I spotted one thing that might have been causing this. There was a change in RSpec 1.2.6 (or so) that changed the return value of RSpec's Example#location causing some issues with the IDE's test runner. This was fixed just recently, so can you please try the latest dev build (http://wiki.netbeans.org/RubyInstallation#section-RubyInstallation-GettingADevelopmentBuild) and see if the problem still exist? Or alternatively you can just download http://hg.netbeans.org/main-silver/raw-file/394f868d1494/ruby.testrunner/release/nb_rspec_mediator.rb and place it to "C:\Program Files\NetBeans 6.7\ruby2" (overwrite the existing file).
I replaced the specified file, restarted the IDE and the problem persists.
Hmm, not sure then where the problem lies. I wasn't able to reproduce this with a similar conf, but I haven't had a chance to test this on Windows (might be the key here). Can you please attach a new log file (after running a test with the updated nb_rspec_mediator)?
Created attachment 90847 [details] detailed log generated after replacing requested file Here is the log you requested. I went through the same steps as before, but this time with the new nb_rspec_mediator.rb file in place
Thanks - I should be able to fix this now based on the new log.
Should be fixed now in ef2c8a49a21d. It seems that for whatever reason RSpec doesn't output example locations on Windows. For failed tests I can however use the location from the backtrace (that's what the fix accomplishes), so re-running failed tests should work now. For passed tests this isn't unfortunately fixable until the location issue is fixed in RSpec.
I tried to verify that this issue is fixed by installing NB 6.8 RC1 Now when I right click on a failed test and choose "Run Again" it does attempt to do something instead of doing nothing which was the behavior in 6.7, however it blows up prior to running the test again. I receive the following error in the test results output window: D:/svn_projects/trunk/vendor/gems/rspec-1.2.9/lib/spec/runner/line_number_query.rb:67:in `expand_path': can't convert nil into String (TypeError) from D:/svn_projects/trunk/vendor/gems/rspec-1.2.9/lib/spec/runner/line_number_query.rb:67:in `is_best_match?' Finished in seconds from D:/svn_projects/trunk/vendor/gems/rspec-1.2.9/lib/spec/runner/line_number_query.rb:49:in `consider_example_group_for_best_match' 0 examples, 0 failures from D:/svn_projects/trunk/vendor/gems/rspec-1.2.9/lib/spec/runner/options.rb:126:in `run_examples' from D:/svn_projects/trunk/vendor/gems/rspec-1.2.9/lib/spec/runner/command_line.rb:9:in `run' from D:/svn_projects/trunk/script/spec:10
Thanks for following up on this, I'll take a look why it's still not working for you.
I can confirm that this bug exists on Ruby 1.8, Rails 2.3.5, NetBeans 6.8, rspec 1.3.0 and rspec-rails 1.3.2. It is actually due to running tests on a particular line with the '-l' or '--line' argument to ./script/spec . I manually invoke the test runner in my Rails app: ./script/spec spec/controllers/bookings_controller_spec.rb -l 159 --runner NbRspecMediator --require /home/asfandq/apps/netbeans-6.8/ruby2/nb_rspec_mediator.rb --options /home/asfandq/src/ygt-sales/spec/spec.opts The following output is produced: /usr/local/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/runner/line_number_query.rb:67:in `expand_path': can't convert nil into String (TypeError) from /usr/local/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/runner/line_number_query.rb:67:in `is_best_match?' from /usr/local/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/runner/line_number_query.rb:49:in `consider_example_group_for_best_match' from /home/asfandq/apps/netbeans-6.8/ruby2/nb_rspec_mediator.rb:233:in `spec_name_for' from /home/asfandq/apps/netbeans-6.8/ruby2/nb_rspec_mediator.rb:231:in `each' from /home/asfandq/apps/netbeans-6.8/ruby2/nb_rspec_mediator.rb:231:in `spec_name_for' from /home/asfandq/apps/netbeans-6.8/ruby2/nb_rspec_mediator.rb:70:in `run' from /usr/local/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/runner/options.rb:152:in `run_examples' from /usr/local/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/runner/command_line.rb:9:in `run' from ./script/spec:10 Looking at nb_rspec_mediator.rb, on line 233, it is calling 'consider_example_group_for_best_match' with an example_group whose location is 'nil'. That 'nil' is what expand_path is attempting to be called on. I hacked nb_rspec_mediator.rb a bit, inserting the following just before the fatal call to 'consider_example_group_for_best_match', hoping it would tell me what the kind of example_group is that does not seem to be compatible the NetBeans mediator: if example_group.location.nil? p example_group end and the class it gave me was 'Spec::Rails::Example::IntegrationExampleGroup' Obviously, the NetBeans mediator does not like custom example groups.. PLEASE fix this, I have tried but cannot for the life of me figure out how to do it. Thanks
Thanks for looking into this! I'll try come up with a fix for this.
Should be fixed now in http://hg.netbeans.org/ruby-main/rev/b714aef48b9a. Please give it a try if you can, it should work with 6.8 too - just download http://hg.netbeans.org/ruby-main/file/b714aef48b9a/ruby.testrunner/release/nb_rspec_mediator.rb and copy it to <nb_install_dir>/ruby/ Let me know if that doesn't fix the issue for you - thanks.
It works! Thanks so much for fixing this bug. It was the biggest cause of productivity loss in NetBeans for me. Now I can re-run a failed spec without having to wait 5 minutes for the rest of the related specs to run. Again, thank you!