Fixed Ruby warnings.

Moved class definitions out of before hooks.