Learn TDD with Ruby
⚠ This is a work in progress! ⚠
This "book" is my attempt to teach idiomatic Ruby and Test-Driven Development (TDD).
Since we'll talk about Ruby, it's inevitable that you'll also learn about Object-Oriented programming (OOP). And since we'll use TDD, you'll inevitably also learn about good software design.
What you should expect
Explore the Ruby language (and OOP) by writing tests.
Get a solid grounding with TDD.
Be confident that you'll be able to start writing robust, well-tested software in Ruby.
The chapters are presented in a sequence where a new Ruby feature is introduced and used to solve a problem. And the implementation of the solution is always driven by tests, reinforcing the TDD cycle.
You'll notice such approach in the very first chapter, where we create a classic "Hello, world" program and gradually make it more sophisticated driven by tests. This approach continues in all chapters.
I have a belief that TDD leads to a better software design. By using TDD you naturally makes your software testable, and consequently make it less coupled and easier to maintain over time.
Who this is for
People who are interested in picking up Ruby.
People who already know some Ruby but want to explore testing more.
I assume you have some experience with coding (any language) and understand the basic concepts of algorithms.
It's also expected that you're comfortable using the terminal (or at least not scared to use it).
What you'll need
A computer
Installed Ruby (3.2+)
A text editor
A terminal
TODO: add Ruby installation instructions.
For testing we're going to use Minitest, which is the testing framework that comes with the Ruby Standard Library.
Feedback
Open issues or submit Pull Requests in this book's repository.
Credits
This book is heavily inspired by the awesome Learn Go with Tests, by Chris James. If you're interested in Golang, you should check that!
Last updated