JRuby and autotest (ZenTest)

JRuby 1.1.2 is going to be released (probably) today and it fixes a bug with $~ constants (Regexp.last_match), which made autotest finally work!

jruby -S gem install ZenTest
cd myproject
jruby -S autotest

I’ve previously submitted a patch to ZenTest guys. It makes the use of autotest possible with any JRuby 1.x, but now, with JRuby 1.1.2, autotest should just work out of the box!

Advertisement

11 thoughts on “JRuby and autotest (ZenTest)

  1. Hi Fabio.

    I installed JRuby 1.1.2 and ZenTest using the commands you suggested but the jruby -S autotest line seems to do nothing for me. The process just hangs there but there is no visible result.

    I’ve tried

    jruby -S autotest

    and

    jruby -S autotest file.rb > test_file.rb

    Nothing ever happens. Maybe you have some suggestions that could help me out.

    Thanks

    Paulo

  2. I’ve just tested it here and it is working.

    What do you have in your ~/.autotest file? You can see mine here: http://pastie.org/237794. This .autotest file notifies autotest results through Growl. It should work in Mac OS X Leopard (as long as you have the required applescript* and images).

    I would also suggest you to take a look in your spec/spec.opts file.

    * required applescript: http://pastie.org/237795

  3. Hmmm…

    I have nothing like an .autotest file. And I have no idea about what Growl might be. To be honest I don’t really know how autotest should work. Shouldn’t we go first through ZenTest to automatically generate the unit test cases? Then working on the “stuffing” and finally running autotest? If this more or less describes the steps that should be taken then I’m not even managing to use ZenTest properly. I can’t get it to autogenerate the test cases.

  4. Fabio,

    I see others with similar complaints to my own. But I can’t find any forums around the zentest site. If you could point me to the proper place to ask my question, I’d be grateful.

    I’m a novice with ruby and even moreso with jruby. Trying to run zentest to generate test code for a class, I get:

    $ jruby -S zentest
    /opt/jruby-1.1.3/lib/ruby/gems/1.8/gems/ZenTest-3.10.0/lib/zentest.rb:5:in `each_object’: ObjectSpace is disabled; each_object will only work with Class, pass +O to enable (RuntimeError)
    from /opt/jruby-1.1.3/lib/ruby/gems/1.8/gems/ZenTest-3.10.0/lib/zentest.rb:5
    from /opt/jruby-1.1.3/lib/ruby/gems/1.8/gems/ZenTest-3.10.0/lib/zentest.rb:27:in `require’
    from /opt/jruby-1.1.3/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require’
    from /opt/jruby-1.1.3/lib/ruby/gems/1.8/gems/ZenTest-3.10.0/bin/zentest:3
    from /opt/jruby-1.1.3/lib/ruby/gems/1.8/gems/ZenTest-3.10.0/bin/zentest:19:in `load’
    from /opt/jruby-1.1.3/bin/zentest:19

    (I’m running on Linux if it matters.) I may be doing something very simple and basic wrong, but google hasn’t helped me out in this regard. Would you have any suggestions?

    Thanks.

  5. Hi Anyone,

    Have you had any luck using jruby 1.1.6 and autotest?
    I’ve installed the latest gem for ZenTest and then went to my project directory and typed ‘autotest’ and I always get the same error:
    “/opt/jruby-1.1.6/lib/ruby/gems/1.8/gems/ZenTest-3.11.1/lib/zentest.rb:5:in `each_object’: ObjectSpace is disabled; each_object will only work with Class, pass +O to enable (RuntimeError)”

    I’ve tried using the +O option and I still get the same error.
    Maybe I’m not calling autotest properly?

    I’d really appreciate anyone has any ideas.

    thanks,

    Litenin’

  6. It’s `jruby -X+O autotest`, I believe. We ran into the same ObjectSpace problem at work, and googled a resolution.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s