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 154313 - Unable to run autotest with RSpec framework
Summary: Unable to run autotest with RSpec framework
Status: RESOLVED INCOMPLETE
Alias: None
Product: ruby
Classification: Unclassified
Component: Testing (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker with 1 vote (vote)
Assignee: Erno Mononen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-02 08:10 UTC by piter
Modified: 2009-03-17 15:29 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description piter 2008-12-02 08:10:01 UTC
I have installed rspec, rspec-rails and ZenTest as gems. Versions of these gems are as follows:

rspec (1.1.11)
rspec-rails (1.1.11)
ZenTest (3.11.0)

Version of Ruby interpreter is 1.8.6 (2008-08-08 patchlevel 286).
I'm unable to start AutoTest from within NetBeans IDE. This is what i've got:

/home/piter/netbeans-6.5/ruby2/nb_autotest_loader.rb:68: warning: method redefined; discarding old hook
/home/piter/netbeans-6.5/ruby2/nb_autotest_loader.rb:65:in `make_test_cmd': undefined local variable or method
`spec_command' for #<Autotest::RailsRspec:0x9569f9c> (NameError)
	from /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/ZenTest-3.11.0/lib/autotest.rb:246:in `run_tests'
	from /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/ZenTest-3.11.0/lib/autotest.rb:231:in `get_to_green'
	from /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/ZenTest-3.11.0/lib/autotest.rb:211:in `run'
	from /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/ZenTest-3.11.0/lib/autotest.rb:209:in `loop'
	from /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/ZenTest-3.11.0/lib/autotest.rb:209:in `run'
	from /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/ZenTest-3.11.0/lib/autotest.rb:139:in `run'
	from /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/ZenTest-3.11.0/bin/autotest:55
	from /opt/ruby-enterprise/bin/autotest:20:in `load'
	from /opt/ruby-enterprise/bin/autotest:20

Finished in 0.0 seconds.
0 tests, 0 failures, 0 errors

Running command autotest from shell in my Rails project root works fine without any problems. The one thing I had to do
was adding ENV['RSPEC'] = 'true' to my atotest binary because without that ENV variable autotest doesn't works with
RSpec tests.

I tested this configuration on two machines with Linux and Mac OS X and on both I've got the same error.
Comment 1 Erno Mononen 2008-12-02 14:50:29 UTC
Thanks for the report. Seems like a method we were relying got removed in RSpec 1.1.11. Currently there is no stable 
API to code against, so this happens from time to time. I'll try to fix this for M1 and attach a patch here for 6.5.
Comment 2 Erno Mononen 2008-12-02 18:21:25 UTC
Should be fixed now, changeset http://hg.netbeans.org/main/rev/a76eadcb99ec. If you don't want to use a dev build, you 
can patch your 6.5 by downloading the two files from the above link and copying them to the /home/piter/netbeans-6.5/
ruby2/ directory. No need to restart the IDE. Let us know if that doesn't solve the issue for you.

On a related note, the IDE should probably run the autospec binary instead of autotest for RSpec tests. I'll handle 
that in a separate issue.
Comment 3 Quality Engineering 2008-12-05 06:11:43 UTC
Integrated into 'main-golden', will be available in build *200812050201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/a76eadcb99ec
User: Erno Mononen <emononen@netbeans.org>
Log: #154313: Unable to run autotest with RSpec framework
Comment 4 piter 2008-12-05 08:28:00 UTC
I patched NB with those files and everything works properly now. Thank you.
Comment 5 piter 2008-12-06 13:43:47 UTC
Hmmm not all things went ok. Autotests starts properly but if there is some error in my code it seems to looping failed
test again and again. The same autotest which is fired from plain console works properly. Another thing is even more
weirder. For example - i have error in my AR model, autotest from NB is in that loop, when i comment out bad part of
code test will pass ok, when i uncomment it autotest does not recognize any changes in this file - only some changes
directly in corresponding test file influences autotest to run again and report an error. As I said - the same autotest
from console works as I excpect - any changes in both my AR model and its test fire autotest to run again but only once. 

Sorry for my english - I hope it could be understand.
Comment 6 Erno Mononen 2008-12-08 10:37:27 UTC
Too bad -- I'm reopening this for further investigation.
Comment 7 Erno Mononen 2008-12-19 19:16:14 UTC
Bumping up the priority.
Comment 8 Erno Mononen 2009-02-12 15:35:01 UTC
Just an update on this: I'm working on this now, I have a fix for the IDE's test loader that seems to fix the problem 
with rspec test, just that it makes the loader incompatible with test/unit.. so I still need to figure out how to make 
both work. 
Comment 9 piter 2009-02-13 12:59:05 UTC
ZenTest gem provides two separate scripts for running tests: autotest and autospec. Maybe two options in context menu
would be better? One for "Autotest test/unit" and another for "Autotest rspec".
Comment 10 Erno Mononen 2009-02-13 13:09:18 UTC
Yes, in fact I have already implemented separate context menu items for autospec and autotest. I still need to do some 
testing before I can commit this stuff. The autospec executable doesn't work with JRuby though, but that has to be 
fixed in autospec itself.
Comment 11 Quality Engineering 2009-02-22 07:59:32 UTC
Integrated into 'main-golden', will be available in build *200902220201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/d353f475a600
User: Erno Mononen <emononen@netbeans.org>
Log: #154313: Unable to run autotest with RSpec framework
Comment 12 Erno Mononen 2009-03-12 15:36:18 UTC
So this should in the dev builds for some time now, can you give it a try and let us know whether it works for you now? 
Thanks.
Comment 13 piter 2009-03-12 18:43:23 UTC
You mean latest nightly build from http://bits.netbeans.org/download/trunk/nightly/latest/ or 6.7M2 from
http://bits.netbeans.org/download/6.7/m2/ ?
Comment 14 Erno Mononen 2009-03-13 10:00:21 UTC
I think the fix is in M2 already, but I'm really not sure now - so please try with the latest nightly to be sure.
Comment 15 Erno Mononen 2009-03-13 10:01:40 UTC
Note: there is now an action named AutoSpec in the project context menu, please use that one instead of AutoTest.
Comment 16 Erno Mononen 2009-03-17 15:29:45 UTC
Marking as incomplete for now, please let us know when you've had a chance to test this.