SUnit is just Smalltalk code and class variables are just objects. If you modify an object it is modified.
My approach to this problem is to modify the "singleton" pattern so that a class has both a "default" instance and a "current" instance. The #'current' method returns the current value if it is not nil, otherwise it returns the default value. The SUnit #'setUp' method sends a new instance as the argument to #'current:', and the #'tearDown' method sets current to nil. Most of you code asks for the current value; this will be the default or the test instance, depending on whether or not the tests are running. James On Oct 16, 2012, at 8:59 AM, sergio_101 wrote: > a quick question on SUnit.. > > do tests run in their own space? > > say i have a model like User.. > > User has a class variable that is an ordered collection of of users.. > > User userList <- should give me and ordered collection.. > > in my tests, if i add users to User userList.. then, in a workspace, i > inspect: > > User userList > > later, i see that my tests users have in fact been added to the > ordered collection.. > > is this expected? > > thanks! > > -- > ---- > peace, > sergio > photographer, journalist, visionary > > http://www.ThoseOptimizeGuys.com > http://www.CodingForHire.com > http://www.coffee-black.com > http://www.painlessfrugality.com > http://www.twitter.com/sergio_101 > http://www.facebook.com/sergio101 > >
