From: Christoph Date: 2004-05-09T04:48:55+09:00 Subject: Re: test unit & singleton Guillaume Marcais schrieb: > Thanks to all of you for good suggestions. Here is another possiblity --- require 'singleton' class MySingletonClass include Singleton end # use or test MySingletonClass, in particular # instantiate it ... my_inst = MySingletonClass.instance # make a temporary copy and remove # the current MySingletonClass constant # and reassign it the uninstantiated # temporary copy. The exmaple assumes that # MySingletonClass is defined in the top scope, # furthermore there are obvious complications # if your stuff depends on the inheritance capility # of the Singleton implementation .. class Object tmp = MySingletonClass.clone remove_const :MySingletonClass const_set :MySingletonClass, tmp end # MySingletonClass is an uninstantiated at # this point ... p (my_inst == MySingletonClass.instance) # false --- /Christoph