waynerobinson/xeroizer — pull request #181 by davwards (2014-12-09 13:16:14+00:00)
Title: Get unit tests passing

Fixed some errors popping up in the unit tests for `Record::Base`. Since the implementation manipulates the class name and uses `const_get` to get the accompanying model class, the tests that used an anonymous class were breaking. Also made a couple of test mocks quack like `BaseModel` instances. The unit tests should be green now.

Another fix for the same issues would be to use a dependency injection rather than the class name manipulation. That would be cleaner to test, but it would change the initialization interface, so I thought I'd submit this way first. We could also use actual classes instead of anonymous stub definitions the way some of the other unit tests do, but this doesn't test the base class itself as conclusively. For the purposes of unit testing an abstract class like this, I like the test-defined child class pattern.