Removed Ruby warnings.

- Using `instance_variable_defined?` to check if an ivar is set.
- Using `unless` instead of `if !` (didn't throw a warning, but eye-catching).
- Using `MiniTest::Test` instead of `MiniTest::Unit::TestCase`.