dradis/dradisframework — pull request #102 by mberth (2014-08-05 15:03:24+00:00)
Title: Refactoring, improved testing for Attachment

Here are some improvements for app/models/attachment.rb
- moved unit tests to RSpec
- added more tests in spec/models/attachment_spec.rb
- split Attachment.find method into smaller methods
- removed some code duplication
- removed some dead code

There is more room for improvement:
- use File instead of subclassing it
- centralize code for the directory layout (along the lines of #node_directory)
- fill in pending specs, e.g. for `delete`
- add specs that are directly related to how Attachments are used in Dradis (e.g. tempfile option?)
- better method comments
- check if find(:first,...) and find(:last,...) are really used (or potentially useful), if not, remove the code.
- move the class out of the models directory, maybe (it is not a subclass of ActiveRecord)