Problem using mocha with Test::Unit

E

Emil Sandin

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?
 
J

James Mead

[Note: parts of this message were removed to make it a legal post.]

The error

2009/8/20 Emil Sandin said:
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 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
 
E

Emil Sandin

James said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,699
Latest member
AnneRosen

Latest Threads

Top