Hello Ruby enthusiast! Hello BDD enthusiast! Welcome to this journey line by line, test by test, using the Behavior Driven Development technique in a interesting project: War Dice Simulation!
I wrote this tiny book to learn BDD and RSpec for myself. I would want to start with a little example. And if was possible with a funny example too. Then I thought: Why not playing dice! Why not playing war dice! Then there you are: Learning BDD playing dice!
The app that we’ll create together uses two classes: Dice and WarDice.
The first chapter I start to construct the RSpec file of Dice class and the Dice class simultaneously and step by step until all of the tests become green.
The second chapter I go on with the WarDice class, that is a simulation of each dice of war game!
Finally, the third chapter I use the classes in a funny shoes application.
The philosophy of this book is to learn making funny things. In one word: Experimentation. Then I hope you enjoy this simple but also instructive book.
The tests used in this book aren’t a silver bullet. They are only a way between some others. How I told, I made to learn RSpec. You can send suggests, clone the project, modify it and codify in other ways. Who knows we’ll playing together in the 2.0 version of this book :).
Now just read the book and have fun!
The complete source code of application you can download in
The complete ebook text and source code you can download in: