[MacRuby-devel] MacRuby and Shoulda
Mike Taylor
lists at codeshorts.ca
Tue May 4 09:59:41 PDT 2010
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20100504/ea3b0284/attachment-0001.html>
More information about the MacRuby-devel
mailing list