JRuby and autotest (ZenTest)

27 May

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!

About these ads

11 Responses to “JRuby and autotest (ZenTest)”

  1. Paulo July 12, 2008 at 4:32 pm #

    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. Brendan July 20, 2008 at 1:36 pm #

    Exactly the same problem here.

  3. Fabio Kung July 21, 2008 at 8:53 am #

    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

  4. Paulo Sargaço July 22, 2008 at 1:54 pm #

    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.

  5. Todd August 21, 2008 at 10:15 pm #

    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.

  6. Paulo Sargaço August 22, 2008 at 8:01 am #

    Hi Todd.

    Check this link: http://markmail.org/message/ovanebd622f54crv#query:%22each_object%20will%20only%20work%20with%20Class%22+page:1+mid:ua5dtsqogcpspmma+state:results.

    I think they may have an answer on the 23 Jul 2008 05:56 post.

    Not sure, though.

    Cheers.

    Paulo

  7. Litenin' January 30, 2009 at 12:29 pm #

    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’

  8. Fabio Kung February 3, 2009 at 1:16 pm #

    @Litenin

    Try:

    jruby -J-Djruby.objectspace.enabled=true -S autotest

  9. Angel N. Sciortino February 18, 2009 at 4:47 pm #

    I get the same error as Litenin, even with -J-Djruby.objectspace.enabled=true

  10. Frank Endriss June 4, 2009 at 1:19 pm #

    Hi JRuby Gurus,

    I get the above error trying it with jruby 1.2.0 and 1.3.0.

    Did somebody found a solution (it’s summer now ;)

    Thanx,
    Frank

  11. Sathya Sekaran May 26, 2010 at 2:01 pm #

    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 )

Twitter picture

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

Facebook photo

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

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: