Test unit & singleton

You can always muck about in the class’ internals:

if $0 == FILE
require ‘test/unit’

class MyObject_Test
def test_functionality_1

  MyObject.instance_eval { @__instance__ = new }
  o = MyObject.instance
  # ... Tests on o, which changes the internal state of o ...
end

def test_functionality_2
  MyObject.instance_eval { @__instance__ = new }
···
  o = MyObject.instance # This instance is polluted 
                        # by previous tests
  # ... Tests on o
end

end
end