© Carleton DiLeo 2019
C. DiLeoClean Rubyhttps://doi.org/10.1007/978-1-4842-5546-9_7

7. Test-Driven Development (TDD)

Carleton DiLeo1 
(1)
Boulder, CO, USA
 

Test-driven development is a scary topic for many new developers, but the concepts are simple. Once you get the hang of TDD, the benefits become clear. Your code will be simpler, cleaner, and easier to refactor. With TDD, we only write the code we need to write, and avoid adding unnecessary fluff. It will no longer be a scary prospect to make changes to your code. You have tests to verify that your changes won’t break existing code. If something goes wrong, you’ll know where the break occurred.

Our goal for this chapter is to create a Calculator class that has a single method. That method will return ...

Get Clean Ruby: A Guide to Crafting Better Code for Rubyists now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.