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.