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.

Bug 148462

Summary: can't run current spec test
Product: ruby Reporter: 64267598 <64267598>
Component: TestingAssignee: Erno Mononen <emononen>
Status: VERIFIED FIXED    
Severity: blocker CC: sustaining
Priority: P3    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Attachments: log ouput

Description 64267598 2008-09-26 10:06:59 UTC
After shift+alt+f6 which should run current spec test, it breaks with:

	from /home/.../project/vendor/plugins/rspec/lib/spec/runner/options.rb:115:in `run_examples'

Finished in  seconds

0 examples, 0 failures
	from /home/.../project/vendor/plugins/rspec/lib/spec/runner/command_line.rb:10:in `run'
	from /home/.../project/script/spec:4

In NetBeans 6.1 it works fine.

This feature was very useful for me.

In wiki written what must be installed Rspec module, but where it can be downloaded?
Comment 1 Martin Krauskopf 2008-09-26 10:50:19 UTC
P5 is the lowest priority, P1 highest. I guess this is not P5. Choosing the middle -> P3. Erno will respond when he gets
back from vacation.
Comment 2 Erno Mononen 2008-09-29 11:32:54 UTC
Seems to work for me with the latest build, could you please provide an example spec file where this does not work for 
you? Also, please paste here the exact build number of your IDE from Help -> About.
Comment 3 64267598 2008-09-29 13:05:40 UTC
Product Version: NetBeans IDE Dev (Build 200809150201)

Edge rails and edge rspec. With rails, rspec gems same issue.

It's not work with any spec.

--------------------------------------------------
require File.dirname(__FILE__) + '/../spec_helper'

class Example; end
describe Example do
  it "should run example" do
    e = Example.new
  end
end
Comment 4 Erno Mononen 2008-09-29 14:49:01 UTC
Might be an issue with edge Rails / edge rspec, I'll test with them.
Comment 5 lennymarks 2008-10-28 22:50:57 UTC
I've been trying to track this down. I'm confident its related to this:

http://rubyforge.org/pipermail/rspec-users/2008-October/009734.html


Comment 6 64267598 2008-10-29 08:08:42 UTC
I has installed both Netbeans 6.1 and 6.5 (Build 200810170201) which use same platform - ruby 1.8.6 (2008-08-11
patchlevel 287) [i686-linux]. Edge Rails, edge rspec.

In Netbeans 6.1 it's work, in 6.5 doesn't work.
Comment 7 Erno Mononen 2008-10-29 20:08:01 UTC
Thanks for the pointer, Lenny. 

For the OP: Can you please turn on detailed logging (http://wiki.netbeans.org/FaqRubyNBLogging) and attach the log file 
here then? 
Comment 8 64267598 2008-10-30 08:01:11 UTC
Created attachment 72876 [details]
log ouput
Comment 9 Erno Mononen 2008-10-30 09:13:07 UTC
Thanks -- seems that in edge rspec they've removed a method we were using. I'll provide a fix soon.
Comment 10 Erno Mononen 2008-10-30 11:52:35 UTC
Here's a patch for <nb_install_dir>/ruby2/nb_rspec_mediator.rb

diff -r 9363476c81c3 -r 426a47b55f6f ruby.testrunner/release/nb_rspec_mediator.rb
--- a/ruby.testrunner/release/nb_rspec_mediator.rb	Wed Oct 29 12:20:01 2008 +0100
+++ b/ruby.testrunner/release/nb_rspec_mediator.rb	Thu Oct 30 09:38:00 2008 +0100
@@ -156,7 +156,7 @@
   def spec_name_for(file, line_number)
     best_match.clear
     file = File.expand_path(file)
-    rspec_options.example_groups.each do |example_group|
+    safe_get_options.example_groups.each do |example_group|
       consider_example_groups_for_best_match example_group, file, line_number
       example_group.examples.each do |example|
         consider_example_for_best_match example, example_group, file, line_number
@@ -175,4 +175,9 @@
     end
   end
   
+  def safe_get_options
+    # there's no 'rspec_options' method in rspec 1.1.11
+    respond_to?(:rspec_options, true) ? rspec_options : Spec::Runner.options
+  end
+
 end

This should fix it for RSpec edge / MRI, for JRuby it still doesn't work due to the issue Lenny pointed out. I will 
push the patch soon, there will be an automatic notification here when it has been integrated. Unfortunately it is too 
late for 6.5, but if you can verify that the fix works, we can include it in the first patch for 6.5.
Comment 11 64267598 2008-10-30 13:34:58 UTC
Well. It work. Thanks.

It's very bad if this issue will be in 6.5 :(
Comment 12 Erno Mononen 2008-10-30 13:51:01 UTC
> It's very bad if this issue will be in 6.5 :(

I know, but on the other hand currently it affects only people using edge rspec, and the first patch for 6.5 should be 
available quite soon after the release. Meanwhile one can use the patch I posted or a 7.0 dev build. Can you mark the 
issue as verified since it works for you now (we have a policy that only verified issues can be included in patches)? 
I've pushed this to the main repo, http://hg.netbeans.org/main/rev/f161defcb28a, so marking as fixed.   
Comment 13 Quality Engineering 2008-10-30 16:42:09 UTC
Integrated into 'main-golden', will be available in build *200810301401* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/f161defcb28a
User: Erno Mononen <emononen@netbeans.org>
Log: #148462: can't run current spec test
Comment 14 64267598 2008-10-30 20:13:52 UTC
Patch make this functional working.
Comment 15 pgebauer 2008-11-10 15:03:22 UTC
Since this issue is P3 priority, in accord with rules "How to include issues into patch"
(http://wiki.netbeans.org/NetBeansPatches) it must include an explanation as to why its backport is necessary and how
safe it is.

Could you please provide such explantion?
Comment 16 pgebauer 2008-11-10 15:03:38 UTC
Since this issue is P3 priority, in accord with rules "How to include issues into patch"
(http://wiki.netbeans.org/NetBeansPatches) it must include an explanation as to why its backport is necessary and how
safe it is.

Could you please provide such explanation?
Comment 17 Erno Mononen 2008-11-10 17:07:47 UTC
The fix is reasonably safe, it just checks whether a certain method present in the current development version of RSpec 
exists (and uses that method if it does exist). The reason to backport is that when a new version RSpec is released 
(which will very likely happen in 6.5 timeframe) people will upgrade RSpec and without the fix they wouldn't be able to 
run the current test from the IDE.
Comment 18 pgebauer 2008-11-19 21:20:40 UTC
The fix has been ported into the release65_fixes repository.

http://hg.netbeans.org/release65_fixes/rev/c0478d9bd8b2

Comment 19 Martin Schovanek 2008-12-03 11:51:59 UTC
Verified by QE in Nb65Patch1 build.
Comment 20 pgebauer 2008-12-03 16:00:02 UTC
The status whiteboard has been changed to 65fixes1-verified based on the comment above.