Source

tdd_ios_kiwi / source / tip_calculator.rst

Full commit

Tip Calculator

Problem Statement

Given that I want to calculate the amount of the tip
When I enter $50 at 17% tip
Then I should see 8.5 for the tip amount
And $58.50 for the total amount

I know this looks weird. The format of this text is called Gerken. This format is used by business to discribe a process they want to preform.

Project Setup

To start the project, we will start with a basic Xcode project. Create a new Single View iOS Application with the name TipCalculator. Setup the project with Unit Tests, ARC and Stroyboards checked.

Now that we have the basic project setup we need to add some ruby components to help with the project. By default Mac has ruby version 1.8.7 installed.

Install and Configure Bundler

The first component we need is Bundler. This will manage ruby dependencies for us. To install:

$ sudo gem install bundler

Bundler gives us commands and tools to manage the installed ruby libaries. To initalize bundler run the following command in the project directory.

$ bundle init

This command creates a file called a Gemfile.

Let's add cocoapods and frank to the Gemfile.

Now we can run:

$ bundle install

This install the ruby gems and all their dependencies. Now we are ready to setup iOS dependencies.