Trying to upgrade from jruby-1.1.2 to the 1.1.6RC1 I’m running into
problems with stubbed behavior(rspec) on java methods being lost
after [].to_java. See below.
require ‘MyClass’
describe “[].to_java” do
Works in jruby-1.1.2 and jruby-1.1.3 but broken in jruby > 1.1.4
it “should behave consistently with stubbed and real return
values” do
real = Java::MyClass.new
stubbed = Java::MyClass.new
real.stringProperty = 'hello'
stubbed.stub!(:stringProperty).and_return'hello'
java_array = [real].to_java(Java::MyClass)
real.stringProperty.should == 'hello'
java_array[0].stringProperty.should == 'hello'
java_array = [stubbed].to_java(Java::MyClass)
stubbed.stringProperty.should == 'hello'
java_array[0].stringProperty.should == 'hello' #fails here
end
end
//MyClass.java
public class MyClass {
public String stringProperty;
}
jruby-1.1.3/bin/jruby $GEM_HOME/bin/spec -v
rspec 1.1.11
jruby-1.1.3/bin/jruby $GEM_HOME/bin/spec -fs reproduce.rb
[].to_java
- should behave consistently with stubbed or directly set java
properties
Finished in 0.074 seconds
1 example, 0 failures
jruby-1.1.6RC1/bin/jruby $GEM_HOME/bin/spec -fs reproduce.rb
‘[].to_java should behave consistently with stubbed or directly set
java properties’ FAILED
expected: “hello”,
got: nil (using ==)
reproduce.rb:19:
WDYT?
-lenny
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email