Skip to content

Instantly share code, notes, and snippets.

@steveburkett
Created October 15, 2011 01:46
Show Gist options
  • Save steveburkett/1288863 to your computer and use it in GitHub Desktop.
Save steveburkett/1288863 to your computer and use it in GitHub Desktop.
no test or bad test
def itoa(val)
val.to_s
end
require 'test/unit'
class TestItoA < Test::Unit::TestCase
def bad_test_simple_val
s = itoa 10
end
end
1 tests, 0 assertions, 0 failures, 0 errors
Next, change the code (oops!)
def itoa(val)
val.to_sss
end
1) Error:test_simple_val(TestItoA):
NoMethodError: undefined method `to_sss' for 10:Fixnum
/Users/steveburkett/workspace/meta/avg.rb:2:in `itoa'
/Users/steveburkett/workspace/meta/avg.rb:9:in `bad_test_simple_val'
1 tests, 0 assertions, 0 failures, 1 errors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment