0
나는이 같은 수준의 조롱과 다양한 예제를 통해 검토 한 결과 :키위의 클래스 메소드를 감시하는 방법은 무엇입니까?
https://groups.google.com/forum/#!topic/kiwi-bdd/hrR2Om3Hv3I
https://gist.github.com/sgleadow/4029858
Mocking expectations in Kiwi (iOS) for a delegate
클래스 Test
는 클래스 메소드 fetch
있습니다.
내가 얻으려고하는 것은 테스트하고 싶은 클래스의 작업 중에 클래스의 메서드가 호출되는지 확인하는 것입니다.
내가 무엇 :
it(@"test", ^{
id mock = [KWMock mockForClass:[Test class]];
[[mock should] receive:@selector(fetch)];
Repository *rep = [[Repository sharedInstance] rep]; //method `rep` invokes [Test fetch] at some point
});
그리고 테스트는 다음과 같은 오류와 함께 실패합니다
[FAILED], expected subject to receive -fetch exactly 1 time, but received it 0 times
내가 잘못 뭐하는 거지? 스파이 메커니즘은 클래스 메소드에서 어떻게 작동해야합니까?