[MacRuby-devel] Issue with running unit tests when requiring rubygems

Eloy Duran eloy.de.enige at gmail.com
Sun Feb 13 04:08:27 PST 2011


Did you also try installing the latest minitest + mocha as suggested? I would expect that to fix such issues. Which would also mean that, like Joshua suggested, we should update our version in stdlib.

On 11 feb 2011, at 23:53, Gabriel Ayuso wrote:

> I did a little more testing and I found out that the problem is apparently by how Mocha changes Test::Unit::TestUnit.
> 
> The only way I was able to make it work was the following:
> 
>  require 'rubygems'
>  gem 'mocha'
>  require 'mocha'
>  require 'test/unit'
>  class QuickTest < Test::Unit::TestCase
>  	include Mocha::API
> 	def test_quick
> 		obj = mock("test")
> 		obj.expects(:do).returns(false)
> 		assert( obj.do )
> 	end
> end
> 
> If I required 'mocha' after 'test/unit' then the NoMethodError exception would be thrown:
> 
> uncaught Objective-C/C++ exception...
> 2011-02-11 23:43:50.675 macruby[83143:903] *** Terminating app due to uncaught exception 'NoMethodError', reason: '/Library/Frameworks/MacRuby.framework/Versions/0.8/usr/lib/ruby/1.9.2/minitest/unit.rb:641:in `block': undefined method `run' for #<QuickTest:0x20039eea0 ...> (NoMethodError)
> 
> Gabriel Ayuso
> 
> On Feb 11, 2011, at 3:59 PM, Joshua Ballanco wrote:
> 
>> Considering that the updated minitest library also contains the new benchmarking facilities (though I don't think that part was officially adopted by MRI), it might be worth considering pulling from upstream.
>> 
>> On Fri, Feb 11, 2011 at 9:37 AM, Eloy Duran <eloy.de.enige at gmail.com> wrote:
>> This *might* be because the minitest version in our stdlib is
>> outdated. You can try to install the minitest gem and require that
>> instead and see if that fixes it.
>> 
>> On Fri, Feb 11, 2011 at 3:24 PM, Gabriel Ayuso <gabriel at gabrielayuso.com> wrote:
>> > I wanted to try using mocha to write unit tests with mocks. After requiring
>> > "rubygems" a NoMethodError exception was thrown when attempting to run the
>> > tests. The method which wasn't found was 'run'.
>> > If I remove the call to require "rubygems" my test fails because I can't use
>> > mocha but the NoMethodError exception which was thrown is not thrown
>> > anymore.
>> > Am I missing something?
>> > Thanks,
>> > Gabriel Ayuso
>> > _______________________________________________
>> > MacRuby-devel mailing list
>> > MacRuby-devel at lists.macosforge.org
>> > http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>> >
>> >
>> _______________________________________________
>> MacRuby-devel mailing list
>> MacRuby-devel at lists.macosforge.org
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>> 
>> _______________________________________________
>> MacRuby-devel mailing list
>> MacRuby-devel at lists.macosforge.org
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> 
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20110213/ca9a9862/attachment.html>


More information about the MacRuby-devel mailing list