Datasheet
Chapter 1: Building Resources
22
Building a Recipe Editor
If you fire up the Rails server and look at the recipe input form, you ’ ll see that at this point, it looks
something like what is shown in Figure 1 - 1 .
Figure 1-1
While maintaining the proper amount of reverence to the tool that provided this form for free, it ’ s easy to
see that it won ’ t do. Ingredients aren ’ t listed, all the boxes are the wrong size, and basically the thing
looks totally generic. Your punch list looks like this:
Make the items that need longer data entry into text areas.
Clean up the organization to look more like a finished recipe.
Add ingredients to the recipe.
Naturally, you ’ ll start by writing some tests.
Adding Ingredients
Test - Driven Development (TDD, sometimes also called Test - First Development) is a practice that first
gained widespread attention as one of the core practices of Extreme Programming (or XP). Even if your
programming is less extreme, writing automated tests is perhaps the best single way to ensure the
quality and stability of your application over time. This is particularly true in Rails, because all kinds of
testing goodness have been built into the framework, making powerful tests easy to write.
❑
❑
❑
c01.indd 22c01.indd 22 1/30/08 4:02:27 PM1/30/08 4:02:27 PM