Ban use of assigns and render_template (assert_template) in RSpec

The 👮 could suggest asserting HTTP code and the actual result/response from the controller.

From https://www.bigbinary.com/blog/changes-to-test-controllers-in-rails-5:

According to Rails team, controller tests should be more concerned about what is the result of that controller action like what cookies are set, or what HTTP code is set rather than testing of the internals of the controller. So, these methods are removed from the core.

See gitlab-org/gitlab#16260.

Implementation guide

  1. Create a 🆕 👮 Rails/ControllerTesting or RSpec/RailsControllerTesting (or a better name!)
  2. Make this 👮 flag the use of assigns and render_template in spec/controllers and spec/requests
  3. Suggest to assert on controller result (response body) instead
  4. Add specs
  5. Link to https://www.bigbinary.com/blog/changes-to-test-controllers-in-rails-5#reasons-for-removing-assigns-and-assert-template (optional)
  6. Mention the alternatives to assigns and render_template in, for example, https://docs.gitlab.com/ee/development/testing_guide/testing_levels.html#about-controller-tests (optional)

Example: https://gitlab.com/gitlab-org/gitlab/blob/434e87ffeee883838558c7c0891c42bdd29506f9/rubocop/cop/gitlab/rspec/avoid_setup.rb#L65-65

Contact person

Edited by Peter Leitzen