allending/Kiwi — pull request #120 by tibr (2012-04-16 08:59:21+00:00)
Title: Fixing a crash when stubbing and spying on an object at the same time.

Pull request #114 breaks produces a crash when stubbing and spying class methods.

For example the two lines

```
[NSDate stub:@selector(dateWithTimeIntervalSince1970:) andReturn:nil];
[[NSDate should] receive:@selector(dateWithTimeIntervalSince1970:) withArguments:any()];
```

both work on their own. However, when both are used in the same it-block the test crashes with "handler threw exception".

http://cl.ly/3S042q3d3E0o1L1j2w43

My solution wraps the tearDown calls ```KWClearAllMessageSpies()``` and ```KWClearAllObjectStubs()``` in a new call ```KWClearStubsAndSpies()``` which makes sure that each object only gets restored to their original class once.

Of course, this also breaks the shorthand method
```
[[NSDate should] receive:@selector(dateWithTimeIntervalSince1970:) andReturn:nil withArguments:any()];
```