[rspec-devel] RSpec on JRuby

aslak hellesoy aslak.hellesoy at gmail.com
Thu Nov 9 07:28:07 EST 2006


I thought I'd try out how RSpec works on JRuby.

I installed JRuby and the diff-lcs gem as described here:
http://www.headius.com/jrubywiki/index.php/Getting_Started

svn co svn://svn.codehaus.org/jruby/trunk/jruby jruby
cd jruby
ant jar
export JRUBY_HOME=$PATH:`pwd`
export PATH=$PATH:$JRUBY_HOME/bin
# Doenload to Desktop:
http://rubyforge.org/frs/download.php/1703/diff-lcs-1.1.2.gem
# couldn't get to work with curl
bin/gem install ~/Desktop/diff-lcs-1.1.2.gem.tar

I started with RSpec's examples - standing in the RSpec root directory:

jruby -Ilib bin/spec examples

........................................

Finished in 0.232 seconds

40 specifications, 0 failures

Yay! A little bit harder:

jruby -Ilib bin/spec failing_examples/diffing_spec.rb --diff

FF

1)
NoMethodError in 'Running specs with --diff should print diff of
different strings'
private method 'raise' called for Kernel:Module
failing_examples/diffing_spec.rb:13:in `should print diff of different strings'

2)
NoMethodError in 'Running specs with --diff should print diff of
different objects' pretty representation'
private method 'raise' called for Kernel:Module
failing_examples/diffing_spec.rb:34:in `should print diff of different
objects' pretty representation'

Finished in 0.032 seconds

Ouch! :-)

And running RSpec's dogfood:

jruby -Ilib bin/spec spec

.....F.FF..F..FFF.......F.F.F.F.FFFFF...FFFFF...F.F....FF....FF.F....FFFFFFFFF.....FF..FFF.F.FFF.......F.F.F.FFFFF.....FFFFF.....F.FException
in thread "main" java.lang.ClassCastException: org.jruby.RubyNil
        at org.jruby.Ruby.printError(Ruby.java:800)
        at org.jruby.Main.runInterpreter(Main.java:166)
        at org.jruby.Main.run(Main.java:111)
        at org.jruby.Main.main(Main.java:86)

Not bad for a first try. I'm not sure whether it's failing because of
Ruby 1.8.5 (that's what JRuby trunk is based on) or JRuby itself.
Maybe building RSpec could be a nice acceptance test for JRuby?

Has anyone tried to run RSpec with (standard) Ruby 1.8.5?

Aslak


More information about the rspec-devel mailing list