NetBeans 6.5 and RSpec 1.2

The following stack trace might be a bit too familiar for those of you who have tried the latest RSpec (1.2.4) with NB 6.5.1:
 from /usr/lib/ruby/gems/1.8/gems/rspec-1.2.4/lib/spec/runner/options.rb:119:in `run_examples'
 from /usr/lib/ruby/gems/1.8/gems/rspec-1.2.4/lib/spec/runner/command_line.rb:9:in `run'
 from /usr/lib/ruby/gems/1.8/gems/rspec-1.2.4/bin/spec:4
 ...

The good news is that the issue is fixed in 6.7 builds and for 6.5.1 you can fix it by downloading this file and copying it to the netbeans_install_dir/ruby2 directory. You may want to make a backup of the existing nb_rspec_mediator.rb file in that directory first.

Update: There was still an issue with running focused tests as reported by Asfand Yar Qazi. I've now changed the link to point to a newer version that should fix that problem.

Comments:

Hi,

This allows me to now run whole spec files. But it does not fix the 'run test at current line' that used to work for RSpec 1.1. Since I can't use RSpec 1.1 (it does not support Rails 2.3), I cannot run tests at the current line.

Please fix!

Posted by Asfand Yar Qazi on April 20, 2009 at 05:41 AM CEST #

Thanks for catcing that! I've changed the download link to point to a newer version that should fix the problem, please give it a try and let me know how it works for you.

Posted by Erno Mononen on April 20, 2009 at 09:04 AM CEST #

Well, whaddaya know, it works! Thanks v. much!

Posted by Asfand Yar Qazi on May 01, 2009 at 02:37 PM CEST #

Correction: it only works for non-Rails apps.

In Rails apps, I now get the following backtrace:

/usr/lib64/ruby/gems/1.8/gems/rspec-1.2.4/lib/spec/runner/spec_parser.rb:56:in `expand_path': can't convert nil into String (TypeError)
from /usr/lib64/ruby/gems/1.8/gems/rspec-1.2.4/lib/spec/runner/spec_parser.rb:56:in `is_best_match?'
from /usr/lib64/ruby/gems/1.8/gems/rspec-1.2.4/lib/spec/runner/spec_parser.rb:38:in `consider_example_group_for_best_match'
from /home/ayqazi/apps/netbeans-6.5/ruby2/nb_rspec_mediator.rb:222:in `spec_name_for'
from /home/ayqazi/apps/netbeans-6.5/ruby2/nb_rspec_mediator.rb:220:in `each'
from /home/ayqazi/apps/netbeans-6.5/ruby2/nb_rspec_mediator.rb:220:in `spec_name_for'
from /home/ayqazi/apps/netbeans-6.5/ruby2/nb_rspec_mediator.rb:67:in `run'
from /usr/lib64/ruby/gems/1.8/gems/rspec-1.2.4/lib/spec/runner/options.rb:119:in `run_examples'
from /usr/lib64/ruby/gems/1.8/gems/rspec-1.2.4/lib/spec/runner/command_line.rb:9:in `run'
from /usr/lib64/ruby/gems/1.8/gems/rspec-1.2.4/bin/spec:4
from /usr/bin/spec:19:in `load'
from /usr/bin/spec:19

Looking at line 222 of nb_rspec_mediator.rb, example_group appears to be ActiveRecord::TestCase, and line 38 of spec_parser.rb sees example_group_file to be 'nil', which is causing all the problems.

Posted by Asfand Yar Qazi on May 06, 2009 at 04:42 PM CEST #

Hi, I'm trying to run RSpec tests with NetBeans 6.5 (I have rspec 1.2.6) and I'm seeing several different things:
- I can run my tests from the project by doing Run/Debug Rake Task, and they do run. However, I only get output... I don't get anything in the Ruby Test Results tab.
- If I check Debug in the dialog for Run/Debug Rake Task I still can't debug any tests. It behaves just as Run.
- If I search in my project for the rb file in spec\\isolation\\google, open it and choose the context menu Debug 'home_page_search.rb' it starts running and I see the debugger stop in every it "should ..." line but I can't step into the code or hit any breakpoints in them. I believe it's because of these errors that I see in the output window:
Fast Debugger (ruby-debug-ide 0.3.4) listens on localhost:2973
No such file or directory - ./config/config.yml
C:\\rubyTests\\google\\spec\\isolation\\google\\home_page_spec.rb:6
undefined method `home_page' for nil:NilClass
C:\\rubyTests\\google\\spec\\isolation\\google\\home_page_spec.rb:74

AFA I can understand there should be some kind of way of telling the environment where are the missing files (for the config file and for the classes), but I don't see where.

My main goal is to be able to debug RSpec tests using the environment instead of "puts". Any chance you can help me? What am I doing wrong?

Posted by Laura Petersen on May 13, 2009 at 02:44 PM CEST #

Hi Asfand,
Thanks again for the catch, I will fix it shortly.

Posted by Erno Mononen on May 14, 2009 at 09:15 AM CEST #

Hi Laura,

Debugging the rake spec (or test) task doesn't unfortunately work currently, the problem is that the task forks another process. As for the last question, I'm not sure now about what is the problem. Can you turn on detailed logging (pls see http://wiki.netbeans.org/RubyDebugging#section-RubyDebugging-HowToFileABug), reproduce the issue and send me the logs? Those logs would also help see the reason why the test results tab doesn't get updated. Thanks.

Posted by Erno Mononen on May 14, 2009 at 09:25 AM CEST #

Post a Comment:
Comments are closed for this entry.
About

emononen's blog

Search

Top Tags
Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today