Running autospec from jruby

I can’t seem to get autospec to run using JRuby. The autospec command
doesn’t seem to work like gem or rake do. Here’s what I get:
arthman:railpro jjathman$ jruby -S autospec
loading autotest/rails_rspec
/opt/local/bin/ruby -S spec/models/rail_connection_spec.rb
spec/controllers/sessions_controller_spec.rb spec/models/reset_spec.rb
…plus other stuff.

Have any JRuby users gotten this working successfully? Thanks.

Joe

Joseph A. wrote:

Have any JRuby users gotten this working successfully? Thanks.
Yeah, I think autospec tries to always run ruby, which is certainly a
bug in autospec. But I thought I’d seen others get it working.

  • Charlie

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

I think I found where the problem is, but I don’t know how to fix it.
In
the autospec script the line:system (RUBY_PLATFORM =~ /mswin|mingw/ ?
‘autotest.bat’ : ‘autotest’), *ARGV

will always end up invoking the first autotest command in the path.
Since
MRI is the first one in my path I think this gets invoked every time.
Anyone have a hack/patch for this?

Joe

On Sun, Dec 14, 2008 at 11:06 AM, Charles Oliver N. <

I’m also not able to run autospec from jruby. I’m pretty new to
autospec, but have gotten it to run successfully with MRI.

Using rails 2.2.2, rspec-1.1.11, rspec-rails-1.1.11, and JRuby 1.1.5 on
Ubuntu:

  1. rails spectest; cd spectest

  2. nano config/database.yml …

  3. jruby -S script/generate rspec

  4. jruby script/generate rspec_controller things index

Then executing:

jruby -S autospec

gives no console output and no indication that anything is happening. I
also uninstalled MRI rspec/rspec-rails because it appeared that this
version was loading. I also removed the default JRuby rspec gem and
re-installed the gem myself (made no difference).

I can, however get my specs to run:

jruby -S spec

Any ideas?

Rich Apodaca wrote:

Any ideas?

Workaround - in script/autospec use ‘jruby -S autotest’:

#!/usr/bin/env ruby
ENV[‘RSPEC’] = ‘true’ # allows autotest to discover rspec
ENV[‘AUTOTEST’] = ‘true’ # allows autotest to run w/ color on linux
system((RUBY_PLATFORM =~ /mswin|mingw/ ? ‘autotest.bat’ : ‘jruby -S
autotest’), *ARGV) ||
$stderr.puts(“Unable to find autotest. Please install ZenTest or fix
your PATH”)

The problem is that this runs autospec very slowly because the entire
rails environment is loaded w/ JRuby each time a change is made to my
code.

I haven’t been able to get druby (which is supposed to avoid the rails
initialization overhead for repeated spec runs) to work under
jruby/rails:

http://rspec.info/documentation/rails/runners.html

It complains:

(druby://127.0.0.1:8989) script/spec_server:14:in `run’: closed stream
(IOError)