Skip to content

Commit

Permalink
Add tests for quote and author
Browse files Browse the repository at this point in the history
  • Loading branch information
Sammidysam committed Jan 7, 2014
1 parent 1a79c9b commit 2460c44
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion test/test_wikiquote.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,26 @@

class XKCDTest < Test::Unit::TestCase
def test_XKCD_get
assert_not_nil WikiQuote.get
assert WikiQuote.get
end

def test_quote
# Assert that it has the correct format,
# which includes no newlines
refute WikiQuote.quote.include?("\n")
# and has a non-whitespace first character
refute WikiQuote.quote[0][/\s/]
# and last character.
refute WikiQuote.quote[-1][/\s/]
end

def test_author
# Assert that it has the correct format,
# which includes no newlines
refute WikiQuote.author.include?("\n")
# and has a non-whitespace first character
refute WikiQuote.author[0][/\s/]
# and last character.
refute WikiQuote.author[-1][/\s/]
end
end

0 comments on commit 2460c44

Please sign in to comment.