Skip to content

Instantly share code, notes, and snippets.

@JonahMoses
Created December 15, 2013 02:46
Show Gist options
  • Save JonahMoses/7968212 to your computer and use it in GitHub Desktop.
Save JonahMoses/7968212 to your computer and use it in GitHub Desktop.
class SchoolTest < MiniTest::Test
def school
@school
end
def setup
@school = School.new
end
def test_an_empty_school
assert_equal({}, school.db)
end
def test_add_student
school.add("Aimee", 2)
assert_equal({2 => ["Aimee"]}, school.db)
end
def test_add_more_students_in_same_class
skip
school.add("James", 2)
school.add("Blair", 2)
school.add("Paul", 2)
assert_equal({2 => ["James", "Blair", "Paul"]}, school.db)
end
def test_add_students_to_different_grades
skip
school.add("Chelsea", 3)
school.add("Logan", 7)
assert_equal({3 => ["Chelsea"], 7 => ["Logan"]}, school.db)
end
end
class School
attr_accessor :db
def initialize
@db = {}
end
def add(name, klass)
db[klass] = [name]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment