Projects

Ticket #336: tc_foo.rb

File tc_foo.rb, 314 bytes (added by mike@…, 2 years ago)

Simple test case with no Cocoa dependency

Line 
1require 'rubygems' 
2gem 'thoughtbot-shoulda' 
3require 'shoulda'
4require 'test/unit'
5
6def fact(x) 
7  return 1 if x == 0
8  return (1..x).inject(:*)
9end
10
11class TC_Test < Test::Unit::TestCase
12  context "My factorial method" do
13    should "return 1 when passed 0" do
14      assert_equal 1, fact(0)
15    end
16  end   
17end