像这样的代码:
@implementation MyClass
- (void)func
{
//MyOtherClassObject is an object passed in when initialising MyClass
NSArray *signals = @[[RACObserve(MyOtherClassObject, prop) subscribeNext:^{{}]];
}
@end
@implementation MyTest
- (void)testSomething
{
MyOtherClass *mock = mock([MyOtherClass class]);
MyClass *myObject = [[MyClass alloc] initWithOtherObject:mock]
[myObject func]; //this won't work since RACObserve will return nil instead of a valid signal
}
@end
那么,有什么方法可以像普通对象一样获得模拟对象 RACObserved 吗?