alphagov/frontend — pull request #285 by jystewart (2013-03-30 16:46:28+00:00)
Title: Refactor artefact fetching

The fetch_artefact method in ApplicationController was overly complex with some awkward inconsistencies such as taking some arguments explicitly and some implicitly (via the params hash). It also required a few other methods that ended up spread around the ApplicationController (and therefore all our controllers) rather than being contained in a single class.

Pulling that code out into its own class also revealed that we didn't have great test coverage for the loading of artefacts, which is a critical piece of this app's functionality. This change introduces a few basic tests and sets us up for better, clearer test coverage in future.