InfoQ

News

RSpec now running on JRuby

Posted by Pat Eyler on Nov 30, 2006 07:03 PM

Community
Ruby
Topics
JRuby,
Agile in the Enterprise,
Dynamic Languages
Tags
BDD

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.

No comments

Reply

Exclusive Content

Tapestry for Nonbelievers

A new article by I. Drobiazko and R. Zubairov introduces v. 5 of the Apache Tapestry component-oriented web framework. The tutorial shows how to create a component and covers IoC in Tapestry and Ajax.

Pete Lacey on REST and Web Services

In this interview, Burton Group consultant Pete Lacey talks to Stefan Tilkov about his disillusionment with SOAP, his opinion on REST, and addresses some of the perceived shortcomings REST vs. WS-*.

Business Natural Languages Development in Ruby

Jay Fields presents his concept of Business Natural Languages - a type of Domain Specific Languages geared towards being readable by domain experts.

Distributed Version Control Systems: A Not-So-Quick Guide Through

Adoption and interest for Distributed Version Control Systems is constantly rising. We will introduce the concept of DVCS and have a look at 3 actors in the area: git, Mercurial and Bazaar.

Segundo Velasquez and Agile as Seen Through the Customer's Eyes

Deborah Hartmann interviewed Segundo Velasquez about his experience as customer with an Agile team during the initial phase of software design of a product.

Fine Grained Versioning with ClickOnce

David Cooksey shows how to fine grained versioning to a ClickOnce deployment using an HttpHandler written with ASP.NET, making partial rollouts to a test audience much easier.

Implementing Manual Activities in Windows Workflow

Windows workflow (WF) is an excellent framework for implementing business processes, but lacks support for human activities. This article describes a completely generic approach for changing this.

Markus Voelter about Software Architecture Documentation

In this interview taken during OOPSLA 2007, Markus Voelter talks about the importance of documenting the software architecture, and gives some good and also bad examples on how it could be done.