mysociety/foi-register — pull request #162 by stevenday (2014-03-06 12:10:07+00:00)
Title: Delete files when attachments are removed

I really wanted to test this, but I think I might have hit a snag around how
Carrierwave fixtures work, in that they don't seem to really exist on disk
when they're created in the test. Therefore, the test isn't as clean as I'd
like, but it seems to do the job.

Similarly, I went for the two-stage `remove!` and then `destroy`, because just
`destroy` didn't seem to cut it. I thought at first this was because the
`after_commit` callback wasn't being fired in the tests, but firing it
manually, and installing the [test_after_commit](https://github.com/grosser/test_after_commit)
gem didn't fix that, so maybe not. This way seems bulletproof, if a little
overkill, but I might be mistaken?

Closes #161