I have never been sure what the difference between these options are
RSpec.describe V2::DirectMessagesController, type: :controller
vs
RSpec.describe V2::DirectMessagesController, type: :request
Or where to even look to figure it out
I have never been sure what the difference between these options are
RSpec.describe V2::DirectMessagesController, type: :controller
vs
RSpec.describe V2::DirectMessagesController, type: :request
Or where to even look to figure it out
Copyright © 2021 Jogjafile Inc.
Request specs provide a thin wrapper around Rails' integration tests, and are designed to drive behavior through the full stack, including routing (provided by Rails) and without stubbing (that's up to you).
A controller spec is an RSpec wrapper for a Rails functional test
(ActionController::TestCase::Behavior)
. It allows you to simulate a single http request in each example, and then specify expected outcomes such as:Controller spec docs: https://relishapp.com/rspec/rspec-rails/docs/controller-specs
Request spec docs: https://relishapp.com/rspec/rspec-rails/docs/request-specs/request-spec