JRuby << RSpec

Posted by aslak.hellesoy

The JRuby team announced at RailsConf 2007 that they will bundle RSpec with JRuby when it goes 1.0. JRuby will only ship with two gems (Rake and RSpec), so I’m extremely proud of being a developer of one of the lucky two, because JRuby is going to be big.

RSpec on JRuby means that the wonders of RSpec will soon be available for Java app developers (as well as JRuby/JRuby on Rails developers), so you can do things like this:


describe Bowling do
  before(:each) do
    @bowling = Bowling.new
  end

  it "should score 0 for gutter game" do
    20.times { @bowling.hit(0) }
    @bowling.score.should == 0
  end
end

And continue implementing the production code in Java:


public class Bowling {
    public void hit(int pins) {
    }

    public int score() {
        return 0;
    }
}

An important step for JRuby adoption, because this will let Java developers get their Ruby feet wet without having to deal with tons of red tape.