Has anyone had any luck using Thoughtbot's Shoulda gem with MacRuby for testing? I'm getting errors like this: 1) Error: test: My factorial method should return 1 when passed 0.(TC_Test): NoMethodError: undefined method `test: My factorial method should return 1 when passed 0.' for #<TC_Test:0x200240f60> I'm fairly new to both Ruby and MacRuby. I'm not sure if the problem is due to MiniTest replacing Test::Unit in Ruby 1.9. Or, if it is a MacRuby issue. Here's my simple test file that works in ruby 1.8: require 'rubygems' gem 'thoughtbot-shoulda' require 'shoulda' require 'test/unit' def fact(x) return 1 if x == 0 return (1..x).inject(:*) end class TC_Test < Test::Unit::TestCase context "My factorial method" do should "return 1 when passed 0" do assert_equal 1, fact(0) end should "return 1 when passed 1" do assert_equal 1, fact(1) end should "return 6 when passed 3" do assert_equal 6, fact(3) end end end I'll keep on digging, but if anyone has any insight, I'd appreciate it! /\/\ike
That's a known issue, I think: https://www.macruby.org/trac/ticket/336 I ran into several problems trying to use both miniunit and the built-in version of test/unit (mostly about integration with mocking packages). I'm now using the testunit gem: test-unit-2.0.7 It's too bad shoulda doesn't work. It's a nice test-unit add-on. On May 4, 2010, at 11:59 AM, Mike Taylor wrote:
Has anyone had any luck using Thoughtbot's Shoulda gem with MacRuby for testing?
I'm getting errors like this:
1) Error: test: My factorial method should return 1 when passed 0.(TC_Test): NoMethodError: undefined method `test: My factorial method should return 1 when passed 0.' for #<TC_Test:0x200240f60>
I'm fairly new to both Ruby and MacRuby. I'm not sure if the problem is due to MiniTest replacing Test::Unit in Ruby 1.9. Or, if it is a MacRuby issue.
Here's my simple test file that works in ruby 1.8:
require 'rubygems' gem 'thoughtbot-shoulda' require 'shoulda' require 'test/unit'
def fact(x) return 1 if x == 0 return (1..x).inject(:*) end
class TC_Test < Test::Unit::TestCase context "My factorial method" do should "return 1 when passed 0" do assert_equal 1, fact(0) end should "return 1 when passed 1" do assert_equal 1, fact(1) end should "return 6 when passed 3" do assert_equal 6, fact(3) end end end
I'll keep on digging, but if anyone has any insight, I'd appreciate it!
/\/\ike
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
----- Brian Marick, independent consultant Mostly on agile methods with a testing slant Author of /Programming Cocoa with Ruby/ www.exampler.com, www.exampler.com/blog, www.twitter.com/marick
We usually recommend to use bacon which is known to work with MacRuby: http://github.com/chneukirchen/bacon/ - Matt On Tue, May 4, 2010 at 6:06 PM, Brian Marick <marick@exampler.com> wrote:
That's a known issue, I think: https://www.macruby.org/trac/ticket/336
I ran into several problems trying to use both miniunit and the built-in version of test/unit (mostly about integration with mocking packages). I'm now using the testunit gem: test-unit-2.0.7
It's too bad shoulda doesn't work. It's a nice test-unit add-on.
On May 4, 2010, at 11:59 AM, Mike Taylor wrote:
Has anyone had any luck using Thoughtbot's Shoulda gem with MacRuby for
testing?
I'm getting errors like this:
1) Error: test: My factorial method should return 1 when passed 0.(TC_Test): NoMethodError: undefined method `test: My factorial method should return
1 when passed 0.' for #<TC_Test:0x200240f60>
I'm fairly new to both Ruby and MacRuby. I'm not sure if the problem is
due to MiniTest replacing Test::Unit in Ruby 1.9. Or, if it is a MacRuby issue.
Here's my simple test file that works in ruby 1.8:
require 'rubygems' gem 'thoughtbot-shoulda' require 'shoulda' require 'test/unit'
def fact(x) return 1 if x == 0 return (1..x).inject(:*) end
class TC_Test < Test::Unit::TestCase context "My factorial method" do should "return 1 when passed 0" do assert_equal 1, fact(0) end should "return 1 when passed 1" do assert_equal 1, fact(1) end should "return 6 when passed 3" do assert_equal 6, fact(3) end end end
I'll keep on digging, but if anyone has any insight, I'd appreciate it!
/\/\ike
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
----- Brian Marick, independent consultant Mostly on agile methods with a testing slant Author of /Programming Cocoa with Ruby/ www.exampler.com, www.exampler.com/blog, www.twitter.com/marick
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
We will make shoulda work with trunk :) So to recap, the bugs are: http://www.macruby.org/trac/ticket/336 http://www.macruby.org/trac/ticket/674 Let me know if I'm missing something else. Laurent On May 4, 2010, at 6:06 PM, Brian Marick wrote:
That's a known issue, I think: https://www.macruby.org/trac/ticket/336
I ran into several problems trying to use both miniunit and the built-in version of test/unit (mostly about integration with mocking packages). I'm now using the testunit gem: test-unit-2.0.7
It's too bad shoulda doesn't work. It's a nice test-unit add-on.
On May 4, 2010, at 11:59 AM, Mike Taylor wrote:
Has anyone had any luck using Thoughtbot's Shoulda gem with MacRuby for testing?
I'm getting errors like this:
1) Error: test: My factorial method should return 1 when passed 0.(TC_Test): NoMethodError: undefined method `test: My factorial method should return 1 when passed 0.' for #<TC_Test:0x200240f60>
I'm fairly new to both Ruby and MacRuby. I'm not sure if the problem is due to MiniTest replacing Test::Unit in Ruby 1.9. Or, if it is a MacRuby issue.
Here's my simple test file that works in ruby 1.8:
require 'rubygems' gem 'thoughtbot-shoulda' require 'shoulda' require 'test/unit'
def fact(x) return 1 if x == 0 return (1..x).inject(:*) end
class TC_Test < Test::Unit::TestCase context "My factorial method" do should "return 1 when passed 0" do assert_equal 1, fact(0) end should "return 1 when passed 1" do assert_equal 1, fact(1) end should "return 6 when passed 3" do assert_equal 6, fact(3) end end end
I'll keep on digging, but if anyone has any insight, I'd appreciate it!
/\/\ike
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
----- Brian Marick, independent consultant Mostly on agile methods with a testing slant Author of /Programming Cocoa with Ruby/ www.exampler.com, www.exampler.com/blog, www.twitter.com/marick
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
participants (4)
-
Brian Marick
-
Laurent Sansonetti
-
Matt Aimonetti
-
Mike Taylor