O'Reilly logo

Effective Testing with RSpec 3 by Myron Marston, Ian Dees

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

Spec Types

For the expense tracker API you built in this book, you wrote three different kinds of specs:

  • Acceptance specs to test the entire app end to end
  • Unit specs to test one layer in isolation
  • Integration specs to test objects with real collaborators and external services

A Rails app is more complex than a tiny API. Accordingly, Rails provides infrastructure for several different kinds of tests, including the following ones:

  • Integration tests that drive your app as a black box via its HTTP interface
  • Functional tests to see how your controllers respond to requests
  • Unit tests to drive a single object or layer
  • Specific tests for models, mailers, and background jobs; any given test here may be a unit or integration test

To test one of these aspects ...

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