MichaelHackett / Kiwi

BDD for iOS
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

KWMock should override NSObject description to display mock name #4

Open MichaelHackett opened 11 years ago

MichaelHackett commented 11 years ago

Currently, if a KWMock object does not have a stub or expectation on -description, it simply forwards the request to NSObject, which prints the class of the object and its address. The thing is, this will print "KWMock", not whatever type of object the mock is supposed to represent, so it's fairly unhelpful. Better still might be to display the name of the mock.

I think this would be helpful in debugging and understanding failure reports (which often print the description of an object involved in an expectation), and should have no ill effects on any program code; after all, if the description mattered to some code under test, you would likely have put a stub on the method (because the default NSObject implementation would not likely have been useful).