thoughtbot/shoulda-matchers — pull request #234 by marxarelli (2013-02-14 22:49:10+00:00)
Title: Refactored error message generation to delegate to ActiveModel

We ran into an issue where we'd overridden the default locale entry for `errors.format` and explicitly included `%{attribute}` in each of our entries under `errors.messages`. In this case, the Shoulda matchers generated different default expected errors messages than what AM had actually generated.

To solve the inconsistency, I've refactored the `default_error_message` helper to delegate to `ActiveModel::Errors#generate_message` when used with ActiveModel 3.0 and up, ensuring that expected messages and those generated by AM under divergent conditions are still consistent.