BT

New Early adopter or innovator? InfoQ has been working on some new features for you. Learn more

RSpec now running on JRuby

| by Pat Eyler on Nov 30, 2006. Estimated reading time: 1 minute |

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.

Rate this Article

Adoption Stage
Style

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

good by kon dai

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

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and dont miss out on content that matters to you

BT