discourse/discourse — pull request #884 by mattvanhorn (2013-05-23 05:51:00+00:00)
Title: Refactor topic

Made changes to the validation to make it more Rails 3 idiomatic and to move things that are not strictly validation out of that and into a more appropriate place. Also began putting the validation error messages into the correct place in the I18n files, so Rails can find them easily by key. Fixed some wording in the tests, and provided a spec to show a good way of testing custom validators.
BTW - the validation tests for topic were flawed. Using a string of 'xxx' fails the quality validation, and so the fact that the length validation tests were broken was never picked up, since the specs only looked at valid or not, not the message or the attribute.