Created
December 15, 2013 02:46
-
-
Save JonahMoses/7968212 to your computer and use it in GitHub Desktop.
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
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 |
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
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