Created
March 6, 2012 17:03
-
-
Save dpetersen/1987524 to your computer and use it in GitHub Desktop.
Now with tests!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
» 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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