Forum: RSpec Running Rspec tests with JRuby fails

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
1fba6e276dac71a245aee1d9744318cc?d=identicon&s=25 Serguei C. (javix)
on 2012-07-06 21:41
How to run RSpec tests with JRuby in a Java project? I tried to run it
with JRuby 1.7.0.preview1,
rspec (2.10.0)
rspec-core (2.10.1)
rspec-expectations (2.10.0)
rspec-mocks (2.10.1)
rspec-rails (2.10.1)

as follows:

jruby -S rspec and got the error:

javix@ubuntu:~/Development/rspec_jruby$ jruby -S rspec spec
NameError: cannot load Java class com.models.Calculator
         for_name at org/jruby/javasupport/
  get_proxy_class at org/jruby/javasupport/
      java_import at
              map at org/jruby/
      java_import at
           (root) at
             load at org/jruby/
           (root) at
              map at org/jruby/
  load_spec_files at
  load_spec_files at
              run at
              run at

Here is the java class, too simple just to be able to test if all works:
in [project_root-src-com-models]:
package com.models;

public class Calculator {

    public int sum(int x, int y){
        return x+y;

Here is the rspec file in

require 'java'
require 'rubygems'
java_import 'com.models.Calculator'

describe "Calculator" do
  it "should add numbers correctly" do
    calc =
    calc.sum(1,3).should == 4

Any idea? Thank you in advance.
This topic is locked and can not be replied to.