If stubbing the property accessor is a possibility, I would go with that. But if you need to partial mock the instance actually created by the real code, it's possible provided it gets stored on the property -- the setter method becomes the hook -- but it's definitely ugly.
The basic idea is to use OCMArg's checkWithBlock: functionality to intercept the argument to the set method, and create the partial mock at that point. You can assign it to a variable outside the block for verification later on. It would look something like this:
-(void)testMethod
{
id mockController = [OCMockObject partialMockForObject:self.controller];
__block id mockVar;
[[[mockController stub] andForwardToRealObject] setVariable:[OCMArg checkWithBlock:^BOOL(id param) {
mockVar = [OCMockObject partialMockForObject:param];
[[mockVar expect] someMethod];
return YES;
}]];
[self.controller method]; // mockVar will be created and assigned during this call
[mockVar verify];
}
If your real code creates an object and only stores it temporarily in a local variable (not an instance variable), there is really nothing you can do, aside from restructuring your real code to make it easier to test (such as moving the code which creates the object into a new method, which makes it much easier to stub).