Using this code under rspec causes an Java::JavaLang::ArrayIndexOutOfBoundsException under JRuby 1.6.7.2 and JRuby 1.7.0.preview1:
# rspec -fd test.rb
# test.rb
describe "JRuby and RSpec" do
it "should not explode" do
"foo#{"\n\n"}".lines("\n\n").map(&:to_s)
end
it "should also not explode" do
("foo" + "\n\n").lines("\n\n").map(&:to_s)
end
end
It looks like some oddity triggered by using string interpolation / extension and multi-character separators. You can trigger the same thing by replacing .map(&:to_s) with a block: {|_|}