You are writing a spec with type: :request
, i.e. an integration spec instead
of a controller spec. Integration specs are wrappers around Rails'
ActionDispatch::IntegrationTest
class. I usually write controller tests using
this instead of type: :controller
, mainly because it exercises more of the
request and response handling stack. So instead of writing something like
get :index
to start the request, you would write get books_path
or similar.
One of the issues with using type: :request
is that you lose the ability to