我BEGIN_SPEC
END_SPEC
在我的规范文件的块中定义了一些我经常重用的辅助块。例如断言某个对话框出现:
void (^expectOkAlert) (NSString *, NSString *) = ^void(NSString *expectedTitle, NSString *expectedMessage) {
UIAlertView *alertView = [UIAlertView mock];
[UIAlertView stub:@selector(alloc) andReturn:alertView];
[[alertView should] receive:@selector(initWithTitle:message:delegate:cancelButtonTitle:otherButtonTitles:)
andReturn:alertView
withArguments:expectedTitle,expectedMessage,any(),@"OK",any()];
[[alertView should] receive:@selector(show)];
};
我想在其他几个规范文件中重用这个块。这是否像我们通常在 Ruby 世界中使用规范助手和 rspec 那样可能?
你如何管理你的全球规范助手?