Skip to content

Instantly share code, notes, and snippets.

@danielmorrison
Created October 19, 2010 18:20
Show Gist options
  • Save danielmorrison/634729 to your computer and use it in GitHub Desktop.
Save danielmorrison/634729 to your computer and use it in GitHub Desktop.
require 'test/unit'
require 'book'
class BookTest < Test::Unit::TestCase
def setup
@book = Book.new
end
def test_should_capitalize_the_first_letter
@book.title = "inferno"
assert_equal "Inferno", @book.title
end
def test_should_capitalize_every_word
@book.title = "stuart little"
assert_equal "Stuart Little", @book.title
end
# let's pretend that the rule is for words of 3 characters or less
def test_should_capitalize_every_word_except_small_words_like_the
@book.title = "alexander the great"
assert_equal "Alexander the Great", @book.title
end
def test_should_capitalize_every_word_except_small_words_like_a
@book.title = "to kill a mockingbird"
assert_equal "To Kill a Mockingbird", @book.title
end
def test_should_always_capitalize_i
@book.title = "what i wish i knew when i was 20"
assert_equal "What I Wish I Knew When I was 20", @book.title
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment