Skip to content

757rb/tdd-workshop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

757rb OO TDD Workshop

Inspired by Sandi Metz 99 Bottles Book. The goal is to write only the code needed to make the test(s) pass. Progress through all 8 tests to complete the exercise.

Setup Instructions

Clone this repo and bundle all required gems.

$ git clone https://github.com/757rb/tdd-workshop
$ cd tdd-workshop
$ bundle install

Run The Tests

In the same terminal widow. Type the following:

$ bundle exec guard

This project bundles Guard which makes running your tests automatically happen once you save a file. The exercise is best done when your editor and terminal open side by side. You should see something like this.

OO TDD Exercise Example - Side by Side Code & Tests

The Exercise

The above image shows we have 1 failing test and 7 pending (skipped) tests. Your job is to write enough code to make the test pass. In this example, you would have to open up the bottles.rb file and write a method called #verse which outputs the needed string.

Once this test passes, proceed down to the second test and remove the line with the word/method skip on it. Hit save. You will presented with another test to make pass. Step and repeat till all 8 tests pass.

Beware! Sometimes making one test pass makes the previous test(s) fail. This is the fun part. You must refactor the code as you learn more about the objects interface. There are no wrong answers! Whatever makes the test pass is good code :)

Share Your Work

Share your gist of your bottles.rb in a new issue or make a pull request. Share and learn.

Releases

No releases published

Packages

No packages published

Languages