Array#to_java with java object reference doesn't carry over object identity
---------------------------------------------------------------------------

                 Key: JRUBY-3224
                 URL: http://jira.codehaus.org/browse/JRUBY-3224
             Project: JRuby
          Issue Type: Bug
    Affects Versions: JRuby 1.1.5, JRuby 1.1.4
            Reporter: Lenny Marks
            Assignee: Thomas E Enebo
         Attachments: spec-patch.txt

http://archive.codehaus.org/lists/org.codehaus.jruby.user/msg/[EMAIL PROTECTED]

Maybe this is necessary, but it can have non-intuitive results when testing 
because stubbed behavior disappears on objects that are passed into java 
methods in java arrays.

e.g the spec below began failing for me after 1.1.3 since the stubbed stuff is 
defined on the java objects directly.

def new_fig_details(values) 
     ..
      fig.stub!(:finalPercent).and_return(values[:percent]) #finalPercent is 
read only method
      ..
      fig
end
...
it "should be able to handle multiple figures" do
      fig = new_fig_details(:num => 1, :width => 12, :height => 11, 
        :picas => 12, :percent => 1.00, :col_size => 1.0, :total => 11)
      
      fig2 = new_fig_details(:num => 2, :width => 11, :height => 12, 
        :picas => 13, :percent => 2.00, :col_size => 3.0, :total => 16)
      
      @data.figureDetails = [fig, fig2].to_java(LengthCheck::FigureDetail)
       
      expected = 
        "  1       1          12      11      12     1.00      1.0      11\n" + 
        "  2       2          11      12      13     2.00      3.0      16\n"
      
      @substitutions.do_figure_substitutions!(@text)
      
      @text.should == expected
    end


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to