Description
I stumbled across a guide on everydayrails.com today that made the following claim:
Both the Rails and RSpec teams suggest replacing or removing your app’s controller tests (also known as the functional test layer), in favor of directly testing models (units), or with higher-level integration tests.
The RSpec 3.5 release notes (where the author presumably got this information) had this to say (emphasis mine):
In Rails 5
assigns
andassert_template
are "soft deprecated". Controller tests themselves are not, and adding:type => :controller
to your specs is still 100% supported.
and
For new Rails apps: we don't recommend adding the
rails-controller-testing
gem to your application. The official recommendation of the Rails team and the RSpec core team is to write request specs instead. Request specs allow you to focus on a single controller action, but unlike controller tests involve the router, the middleware stack, and both rack requests and responses. This adds realism to the test that you are writing, and helps avoid many of the issues that are common in controller specs.
So it sounds like controller specs are discouraged, but not deprecated (in adherence to SEMVER)? If this is the case, perhaps it would be helpful to add a note to this effect in the README of this repo (specifically, the “Controller Specs” section)?
If the maintainers are okay with this idea, I'd be happy to submit a PR.