Ruby On Rails Lesson
With the work we’ve done writing integration test for the static pages, writing tests for the routes is simple: We just replace each occurrence of a hard-coded address with the desired named route from Table 5.1. In other words, we change
and so on for the other pages. The result appears in Listing 5.20.
Listing 5.20 Tests for the named routes.
As usual, you should check that the tests are now red:
By the way, if the code in Listing 5.20 strikes you as repetitive and verbose, you’re not alone. We’ll refactor this mess into a beautiful jewel in Section 5.3.4.