Exception mocking object under observation

Discussion of the OCMock framework. If you have patches we would prefer you to send them to the mailing list, but attaching them to a topic is possible, too.

Exception mocking object under observation

Postby drewag » 10 Dec 2012, 21:50

I am seeing an exception when mocking an object that is already under KVO observation. Here is a simplified example that shows the problem:

Code: Select all
[sourceObject addObserver:destinationObject forKeyPath:@"stringProperty" options:NSKeyValueObservingOptionNew context:nil];
[OCMockObject partialMockForObject:sourceObject];
[sourceObject removeObserver:destinationObject forKeyPath:@"stringProperty"];


When calling "-removeObserver:forKeyPath:" I get an exception that I am not currently observing the object. If I call "-stopMocking" on the mock before calling "-removeObserver:forKeyPath:" everything works fine.
drewag
 

Return to OCMock



cron