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

Managing Controller and View Tests

Testing controllers and views is a very tricky part of Rails testing. Unlike model testing (which tends to be isolated to the particular model) or integration testing (which explicitly covers the entire stack), controller and view testing have boundaries that are more blurred. Controlling those boundaries is the difference between tests that run quickly and fail only when the logic being tested is incorrect, and tests that are slower and dependent on logic outside the test.

Ideally, controller tests are written so that they have minimal interaction with the model. There are costs to be balanced. A controller action that has minimal contact with the model and can therefore have that interaction stubbed will ...

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