Fix test bug for ruby without ENABLE_SHARED

The tests did not take into ENABLE_SHARED into account properly and
would fail on ruby with ENBALE_SHARED = no

This also adds Gem.extension_api_version which makes the tests easier to
write.