From the course: Ruby: Testing with RSpec

Unlock the full course today

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

A TDD example: Part three

A TDD example: Part three - Ruby Tutorial

From the course: Ruby: Testing with RSpec

Start my 1-month free trial

A TDD example: Part three

- In this movie, we'll continue our test driven development example. We've written test and code for the first three items on our list. You might think that we're ready to move onto item number four but I noticed something about our test that we should pause a moment to consider. It occurred to me that in our previous test we're setting doors equal to one and that doesn't really make sense. It doesn't really match with what our client asked us for. They said they wanted to know whether a car was a 2-door coupe or a 4-door sedan. So, it kind of implies that they're expecting it to be either 2 or 4. We didn't pick that up in our original specifications but once I stopped and thought about it I realized that that is something that we actually need to have another example for. So, my solution is that I think if it's not 2 or 4 that it should then default to 4 since 4 is our default. So, if they give us twenty as the number of doors we're not gonna accept that. We're gonna use the default…

Contents