I have a singleton class, and can't unit test their code.
I have test like:
Db *db = [[Db alloc] initWithName:@"sample.db"];
[db createDb];
STAssertEquals([db existDb],YES,@"The db is not created!");
But only work the first. When the second is executed, I always get "null" from the initWithName method. When I remove the singleton support code, all work as expected.
I could hack the testing (but I don't know how right now) but wonder if exist a "poper" way to deal with this.
The singleton is located here: http://code.google.com/p/chibiorm/source/browse/trunk/src/Db.m