Fix ruby warnings

* Move common test methods out of individual tests so they are not
re-declared
* Whitespace