Fix an issue with Rugged::Object#lookup not honoring the object type.

Subclasses of Rugged::Object should only be able to look up objects of
their type, but were returning any object type.
Make sure subclasses are handled correctly.
Only loop over ancestors if necessary.
Also add tests for subclasses of Rugged::Object.
Merge pull request #264 from arthurschreiber/fix-lookup

Fix an issue with Rugged::Object#lookup not honoring the object type.