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 ...
Get Rails 4 Test Prescriptions now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.