Testing Views and View Markup

We’ve tested a helper for project status, but when we go to the browser the new status DOM elements don’t show up. This is because we haven’t placed our new helper in the view template itself. Naturally, we would like our dazzling two-line helper to be incorporated into the view.

From a TDD perspective, we have a few options:

  • Write no further tests, and just insert the helper into the view template. Technically we’re not adding logic, so we can kind of squeak by with this one. I don’t mean to be glib here—having no extra test may be the right choice when the test is a) expensive, b) trivial in the larger scheme of things, and c) easy to visually inspect.

  • Write an integration test using Capybara, as we saw in Chapter ...

Get Rails 4 Test Prescriptions now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.