Created
January 13, 2015 15:19
-
-
Save jamesdabbs/1e98b6bda58e13f6519e to your computer and use it in GitHub Desktop.
Short quiz on classes
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
# Download and run this file, and get the specs passing | |
# You might need to `gem install minitest` | |
require 'minitest' | |
class Dog | |
# You need to define this class so that the specs below pass | |
end | |
require 'minitest/autorun' | |
class TestDog < MiniTest::Test | |
def test_that_dogs_know_their_human | |
sadie = Dog.new 'Mason' | |
assert_equal sadie.human, 'Mason' | |
end | |
def test_that_dogs_are_usually_hungry | |
lucky = Dog.new 'James' | |
assert_equal lucky.hungry?, true | |
end | |
def test_that_dogs_arent_hungry_after_being_fed | |
lucky = Dog.new 'James' | |
lucky.feed! | |
assert_equal lucky.hungry?, false | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment