O'Reilly logo

Rails 4 Test Prescriptions by Noel Rappin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required