Created
March 8, 2015 02:25
-
-
Save justincampbell/a589b0ad1c4af2cb0177 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class Game | |
attr_accessor :home | |
attr_accessor :away | |
def initialize(home, away) | |
@home = home | |
@away = away | |
end | |
def city | |
@home.city | |
end | |
end | |
class Team | |
attr_accessor :name | |
attr_accessor :city | |
def initialize(city, name) | |
@name = name | |
@city = city | |
end | |
end |
This file contains hidden or 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
gem 'minitest' | |
require 'minitest/autorun' | |
require_relative 'scorer' | |
class GameTest < MiniTest::Test | |
def test_game | |
home = Team.new("Philadelphia", "Eagles") | |
away = Team.new("New York", "Giants") | |
game = Game.new(home, away) | |
assert_equal game.home.name, "Eagles" | |
assert_equal game.away.name, "Giants" | |
assert_equal "Philadelphia", game.city | |
end | |
end | |
class TeamTest < MiniTest::Test | |
def test_team_name | |
team = Team.new("Atlanta", "Falcons") | |
assert_equal "Atlanta", team.city | |
assert_equal "Falcons", team.name | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment