Created
March 2, 2020 19:00
-
-
Save nethad/db34562247a2a7b8c67a864bc59b2466 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
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