relevance/diametric — pull request #27 by dwbutler (2012-12-07 20:20:57+00:00)
Title: Support for #save!

This patch adds support for #save! to Diametric::Entity. The motivation for this was to use FactoryGirl for fixtures in my unit tests. FactoryGirl calls #save! instead of #save.

#save! is not defined by ActiveModel, but is separately implemented by ActiveRecord, Mongoid, etc. The only requirement is that this method raises an error when validation fails. The type of error is not specified, so I defined Diametric::Errors::ValidationError.

The code is partially cribbed from Mongoid. =)

Specs are included, but I did have issues passing the integration spec on my machine. I'm not sure what the issue is, but the master branch fails on my machine and passes on Travis, so I don't think it's related to any code I've written.