Skip to content

Instantly share code, notes, and snippets.

@nethad
Created March 2, 2020 19:00
Show Gist options
  • Save nethad/db34562247a2a7b8c67a864bc59b2466 to your computer and use it in GitHub Desktop.
Save nethad/db34562247a2a7b8c67a864bc59b2466 to your computer and use it in GitHub Desktop.
require "minitest/autorun"
require "minitest/pride"
################################################################################
# Tests
#
# You are NOT allowed to change the tests, the only thing you are
# allowed to change are removing the "skip" calls.
#
# The implementation of your tests follows at the end of the file,
# below the test code.
#
# To run this, call:
#
# ruby object_state.rb
#
#################################################################################
class TravelTest < Minitest::Test
def self.test_order
:sorted
end
def test_1
# Hints:
# - Remove the skip call so this test actually fails
# - The failing tests tells you something about "uninitialized constant"
# - What is the smallest thing you can write so this code below does not fail?
skip
person = Person.new
end
def test_2
# Hints:
# - Again, remove the skip so this test runs
# - What do you have to implement so this test runs?
# - Is your implementation minimal?
skip
person = Person.new
assert_equal "Lana", person.name
end
def test_3
# Hints:
# Replace your name implemention with this code:
#
# def name
# @name
# end
#
# You are NOT allowed to change this "name" method or this test.
# How can can you make this test pass?
skip
person = Person.new
assert_equal "Anna", person.name
end
def test_4
# Hints:
# Without changing this test or the implementation of the name method,
# how can you make this test pass?
skip
person = Person.new("Christie")
assert_equal "Christie", person.name
end
end
######################################################################
#
# IMPLEMENTATION
#
######################################################################
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment