Testing Views and View Markup
Get started with view testing and learn how to plan and write view tests.
We'll cover the following...
RSpec view testing
We’ve tested a helper for project status, but the new status DOM elements don’t show up when we go to the browser. This is because we haven’t placed our new helper in the view template itself. Naturally, we would like the dazzling two-line helper to be incorporated into the view. From a TDD perspective, we have the following few options:
- Write no further tests. Insert the helper into the view template. Technically we’re not adding logic, so we can kind of squeak by with this one. We don’t mean to be glib here. Having no extra test may be the right choice when the test is expensive, trivial in the larger scheme of things, and easy to inspect visually.