Correct stub undefined parent modules all the way down when stubbing a nested constant.

This is necessary for verifying doubles to work correctly, since they
need to distinguish between real and stubbed constants.

This fell out quite nicely. I'm not confident I've either named the `Constant` spec correctly nor covered the correct cases (though it certainly fails before this change), so please review that in particular.

Fixes #529.

R @myronmarston @JonRowe