BT

RSpec now running on JRuby

by Pat Eyler on Nov 30, 2006 |

RSpec, the Behavior Driven Development(BDD) library for Ruby, has been solidifying on JRuby recently.  A post to the mailing list last week pointed out that it's now passing nearly 100% of its specification (the RSpec term for a test suite).This is great news for the RSpec developers but it has wider implications as well.

The RSpec specification touches some exotic parts of Ruby's internals, so getting all the tests to pass is a big deal.  Aslak Hellesoy said,
"[I]t pushes Ruby to its limits by using some fairly exotic metaprogramming in the internals. If JRuby is able to run RSpec's spec suite this is a very good indication that JRuby is on par with standard Ruby."
Anything that helps drive JRuby towards complete interoperability with the original interpreter is a good thing.

Since RSpec on JRuby can be used to test Java code, this is also good news for BDD on Java.  Aslak gave this example:

require 'java'
include_class 'java.net.ServerSocket'

context "ServerSocket" do
 specify "should know its own port" do
   server_socket = ServerSocket.new(5678)
   server_socket.localPort.should == 5678
 end
end
Charles Nutter added:

I think it's certain that dynlang-based testing frameworks — especially RSpec — are going to make TDD and BDD far easier on the Java platform than anything of the Java-based tools available today. There's no doubt in my mind.

The maturation of RSpec (and other tools) on JRuby should also help to continue the adoption of Ruby by Java-centric shops, according to Michael Studman (a Jruby developer):

RSpec is a beautiful example of what's possible in Ruby: a natural, logical, consistent & delightful API. I hope that RSpec on JRuby, besides becoming the de-facto way to develop BDD for the Java platform, also causes more Java developers to sit up and notice Ruby as a language with incredible potential for all manner of problems.

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

1 Discuss

Educational Content

General Feedback
Bugs
Advertising
Editorial
InfoQ.com and all content copyright © 2006-2014 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT