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 Cheat Sheet

Spec typeUse for…What it providesNotes

:feature

  • Testing the entire app, including the in-browser UI, via Capybara

  • feature/scenario aliases for describe/it

  • Access to the Capybara API, including visit, fill_in, and so on[129]

  • Named route helpers of the form some_route_path

  • Requires the Capybara gem

:request

  • Non-JavaScript interactions, such as APIs

  • Excercising all layers of your Ruby code

  • Multiple requests, controllers, sessions

  • Request helpers like get ’/index’, post ’/create’

  • Request matchers; see Rails Matchers Cheat Sheet

  • Named route helpers of the form some_route_path

  • Uses the Rails router and Rack middleware stack

  • Similar to the acceptance specs you wrote for the expense tracker API

:model

  • Testing your ...

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