Skip to content

Instantly share code, notes, and snippets.

@dpetersen
Created March 6, 2012 17:03
Show Gist options
  • Save dpetersen/1987524 to your computer and use it in GitHub Desktop.
Save dpetersen/1987524 to your computer and use it in GitHub Desktop.
Now with tests!
» ruby -wv test.rb <~>
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.2.0]
Run options:
# Running tests:
..
Finished tests in 0.000647s, 3091.1901 tests/s, 3091.1901 assertions/s.
2 tests, 2 assertions, 0 failures, 0 errors, 0 skips
require 'test/unit'
class Problem
end
class Bitch < Problem
end
Problems = []
99.times { Problems << Problem.new }
class TestProblems < Test::Unit::TestCase
def test_number_of_problems
assert_equal 99, Problems.length
end
def test_problem_types
assert_nil Problems.detect { |p| p.is_a?(Bitch) }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment