Problem using mocha with Test::Unit

I have this simple test:

require “test/unit”
require ‘mocha’

class TestCanPreload < Test::Unit::TestCase
def test_hello
assert true
end
end

I try to run it in eclipse/aptana, but I get the error:
Launched class is not compatible with Test::Unit::TestCase

However, if I remove the line “require ‘mocha’”, it works fine.

My environment:
ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32]
Windows Vista
Mocha 0.9.7

Any ideas why this happens?

The error

2009/8/20 Emil S. [email protected]

Any ideas why this happens?

The error message doesn’t look Ruby- or Mocha-related. I suspect it is
specific to Aptana/Eclipse which I do not use.
Mocha does monkey-patch Test::Unit::TestCase, but it should not change
it’s
public API, so I’m not sure what the problem is.

I’d suggest asking on the Aptana/Eclipse mailing list. If it turns out
there
is a problem with Mocha, tell us about it on the Mocha mailing list :-

http://groups.google.com/group/mocha-developer

James M. wrote:

The error message doesn’t look Ruby- or Mocha-related. I suspect it is
specific to Aptana/Eclipse which I do not use.

You’re probably right. The error message comes from the class
Test::Unit:UI:Eclipse. It certainly seems that Eclipse/Aptana is the
cause of the problem.
Thank you for your help.

Regards Emil

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs