InfoQ

News

RSpec now running on JRuby

Posted by Pat Eyler on Nov 30, 2006

Community
Ruby
Topics
JRuby ,
Dynamic Languages ,
Agile in the Enterprise
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.
good by dai kon Posted Nov 19, 2008 10:57 AM
  1. Back to top

    good

    Nov 19, 2008 10:57 AM by dai kon

Educational Content

Brian Marick on 4 Challenges and 5 Guiding Values of Agile Software Development

Brian Marick takes us through a quick tour of the most important values and challenges to adopting Agile successfully (they aren't the typical challenges and values we hear in the community).

Are You a Software Architect?

The line between development and architecture is tricky. Does it exist at all? Is an ivory tower actually needed? There's a balance in the middle, but how do you move from developer to architect?

Agile – A Way of Life and Pragmatic Use of Authority

The word 'authority' sometimes produces an allergic response in hard-line agilists. Freedom and authority – both are bad if misused and both are good if used in right spirit for a noble cause.

Getting Started with Grails, Second Edition

"Getting Started with Grails" brings you up to speed on this modern web framework. Companies as varied as LinkedIn, Wired, and Taco Bell are all using Grails. Are you ready to get started as well?

Using ITIL V3 as a Foundation for SOA Governance

Those familiar with only ITIL V2 often scoff at the thought that ITIL could serve as a governance framework for SOA. With ITIL V3, the focus of the framework shifted towards service-orientation.

Adrian Colyer on AspectJ, tc Server and dm Server

SpringSource CTO Adrian Colyer discusses AspectJ, SpringSource's dm Server and tc Server products, OSGi and Scrum.

Adam Wiggins on Heroku

Heroku's Adam Wiggins talks about Rails, Background Jobs, Add-Ons, Ruby, and how Heroku manages to work around Ruby's inefficiencies using Erlang and other languages.

SOA as an Architectural Pattern: Best Practices in Software Architecture

For Grady Booch the foundation of a good architecture is patterns, SOA being just one of many patterns. In this Second Life presentation, Booch attempts to bring more clarity on what architecture is.