I have a Ruby class that draws graphs for a Rails project, using JRuby
to
access Java functionality, and it works fine. However, the unit tests
fail,
objecting that I have an uninitialized constant for an imported Java
class
name:
C:/jruby-1.3.0RC2/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:105:in
`const_missing’: uninitialized constant Graph::Color (NameError)
Here is a stripped down version of the class:
include Java
class Graph
import java.awt.Color
FOREGROUND = Color.new 0.2, 0.2, 0.2
def trivial
10
end
end
And a unit test:
require ‘test_helper’
class GraphTest < ActiveSupport::TestCase
def test_trivial
assert 10, Graph.trivial
end
end
Using JRuby 1.3.0RC2 by the way, with NetBeans 6.5.1 and Java 1.6.0_13.