Mongoid 3 compatibility

Fixed the tests and made the gem work with mongoid < 4