I’ve been coming across a lot of Rails functional tests that look like this:
Some of it is repetitive (you always have to always create the controller, request, and response, and reopening the class). Some is unnecessary (requiring the file).
I’m not sure when it was added, but Rails provides ActionController::TestCase which does this boilerplate stuff up for you. Here’s what we can change to it to: