I'm not sure if that was the best title, but basically I know that a variable will become instantiated upon running a function. I want to do a partial mock of this variable and expect certain method calls before the variable is instantiated. Here's an example of what I'm trying to do.
-(void)testMethod {
id mockVar = [OCMock partialMockForObject:self.controller.variable];
[[mockVar expect] someMethod];
[self.controller method];
[mockVar verify];
}
The method inside the controller will look something like:
-(void)method {
self.variable = [[Class alloc]init];
[self.variable someMethod];
}
I'm receiving a message like 'doesNotRecognizeSelector'. Is this possible?