Skip to content

Instantly share code, notes, and snippets.

@RedSoxFan22
Created May 28, 2015 13:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RedSoxFan22/0d58924c49c7a9763267 to your computer and use it in GitHub Desktop.
Save RedSoxFan22/0d58924c49c7a9763267 to your computer and use it in GitHub Desktop.
require 'minitest/autorun'
require 'minitest/pride'
require './may1.rb'
module Intelligent
NUMBER_OF_LEGS = 2
NUMBER_OF_BRAINS = 1
class Human
def say_name
puts "My name is #{@name}."
end
def run
puts "Huff puff huff puff"
end
end
end
class Human
include Intelligent
include Bipedal
def initialize(name)
@name = name
end
end
class IncludeChallenge < MiniTest::Test
def test_speaking
assert_equal "My name is Zelda", Human.new("Zelda").say_name
assert_equal "My name is Mary", Human.new("Mary").say_name
assert_equal "My name is Amanda", Human.new("Amanda").say_name
end
def test_running
assert_equal "Huff puff huff puff", Human.new("Zelda").run
assert_equal "Huff puff huff puff", Human.new("Mary").run
end
def test_constants
assert_equal 2, Human::NUMBER_OF_LEGS
assert_equal 1, Human::NUMBER_OF_BRAINS
end
def test_methods_like_constants
human = Human.new("Zelda")
assert_equal 2, human.number_of_legs
assert_equal 1, human.number_of_brains
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment