7.6 Exercises

    Verify that the code in Listing 7.30 allows the gravatar_for helper
defined in Section 7.1.4 to take an optional size parameter, allowing
code like gravatar_for user, size: 40 in the view.
    Write tests for the error messages implemented in Listing 7.23. A
suggested start appears in Listing 7.31.
    By writing the test first or by intentionally breaking and then
fixing the application code, verify that the tests in Listing 7.32
correctly specify the desired behavior after saving the user in the
create action. Listing 7.32 uses the have_selector method introduced in
the Chapter 5 exercises (Section 5.6). In this case, we use
have_selector to pick out particular CSS classes along with specific
HTML tags.
    As noted before, the flash HTML in Listing 7.27 is ugly. Verify by
running the test suite that the cleaner code in Listing 7.33, which uses
the Rails content_tag helper, also works.