Skip to content

Instantly share code, notes, and snippets.

@BrianZanti
Last active July 3, 2018 19:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BrianZanti/5d69d48440b8e502c584b554361f1dad to your computer and use it in GitHub Desktop.
Save BrianZanti/5d69d48440b8e502c584b554361f1dad to your computer and use it in GitHub Desktop.

Iteration 1 - Make, Model, Color Attributes

Use TDD to drive the creation of a Car class that follows this interaction pattern:

car = Car.new("Toyota", "Camry")
#=> #<Car:0x007fc47816ba68 @make="Toyota", @model="Camry">
car.make
#=> "Toyota"
car.model
#=> "Camry"
car.color
#=> "white"

Iteration 2 - Paint and Odometer

Use TDD to drive out the following behavior

car = Car.new("Toyota", "Camry")
car.color
#=> "white"
car.paint("blue")
car.color
#=> "blue"
car.odometer
#=> 0
car.odometer.class
#=> Integer

Iteration 3 - The horn and Driving

Use TDD to drive out the following behavior

car = Car.new("Toyota", "Camry")
car.horn
#=> "BEEEEEEEEP"
car.drive(12)
#=> "I'm driving 12 miles"
car.drive 6
#=> "I'm driving 6 miles"
car.odometer
#=> 18

Iteration 4 - Starting and Stopping the Car

Use TDD to drive out the following behavior

car = Car.new("Toyota", "Camry")
car.start
#=> "Starting up!"
car.start
#=> "BZZT! Nice try, though."
car.stop
#=> "Stopping"
car.stop
#=> "BZZT! Nice try, though."
car.start
#=> "Starting up!"

Iteration 5 - Road Trip

Write a method that takes the car on a road trip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment