Rewrite CsvPreviewControllerTest
Rewrite CsvPreviewControllerTest

I re-wrote the tests from scratch by looking at the implementation and
trying to achieve as full coverage as possible. I then also checked the
previous implementation to see if there was anything I had missed.

I did this for the following reasons:

* I found many of these tests hard to read
* There was a lot of duplication
* Some tests were passing partly by accident
  * In many cases BaseAttachmentsController#attachment_visible? was
    returning false for the wrong reason
* Some scenarios were not covered

The fact that it's a re-write rather than incremental changes means that
unfortunately the diff won't be very useful when reviewing the change -
it would probably be better to compare the before and after versions of
the file.

I've taken the approach of stubbing
BaseAttachmentsController#attachment_data and stubbing methods on
AttachmentData rather than setting up all the relevant models in the
database. These methods are well tested elsewhere and doing it this way
made it easier to have a default set of stubs for the happy path which
could be altered for the non-happy path. I think this makes the tests
easier to read.

This approach means that I'm stubbing the AttachmentData predicate
methods which are used in the implementation of
AttachmentData#visible_to?.

While the approach means that the CsvPreviewControllerTest#setup_stubs
method is quite complicated, I think it's worthwhile. I could've avoid
this complication if I could've used Minitest::Spec::DSL style tests
with nested contexts, but unfortunately this doesn't seem to work in
Rails controller tests.

alphagov/whitehall,alphagov/whitehall,alphagov/whitehall,alphagov/whitehall