From the course: Ruby: Testing with RSpec

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

A TDD example: Part one

A TDD example: Part one - Ruby Tutorial

From the course: Ruby: Testing with RSpec

Start my 1-month free trial

A TDD example: Part one

- Let's try an example of test driven development together. Let's go back to our car project to do it. We're gonna keep it simple. Let's imagine that we show this work in progress project to our client and the client says, "You're on the right track "but the number of doors in an important attribute too. "We need to know if a car is "a 2-door coupe or a 4-door sedan. "If we don't know, then we can default to having 4-doors." All right, so we take that back to our office, and we sit down, and we try and parse it out into something that we can put into code. So, we say, all right, well the staff wants to be able to tell if a car is a coupe or a sedan. That means that we're going to need to add the door number to the user questions that we ask. It also means that once we have that door number from the user we're gonna need to create a new car using that door's option. If they don't have an option, then we know that new cars should default to having four doors and on a very fundamental…

Contents