Skip to content

Instantly share code, notes, and snippets.

@zeroeth
Created July 25, 2012 15:16
Show Gist options
  • Select an option

  • Save zeroeth/3176720 to your computer and use it in GitHub Desktop.

Select an option

Save zeroeth/3176720 to your computer and use it in GitHub Desktop.
no irb test driven example
require "test/unit"
class String
def palindrome?
stripped = self.gsub(/\W/,'')
stripped == stripped.reverse
end
end
class TestPalindromeChecker < Test::Unit::TestCase
def test_returns_true
assert "race car".palindrome?
end
def test_returns_false
assert !"xrace car".palindrome?
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment