How to stub a class method in OCMock?

前端 未结 5 1878
谎友^
谎友^ 2020-12-29 03:04

I often find in my iPhone Objective-C unit tests that I want stub out a class method, e.g. NSUrlConnection\'s +sendSynchronousRequest:returningResponse:error: method.

<
5条回答
  •  鱼传尺愫
    2020-12-29 03:56

    Here is a nice 'gist' with a swizzle implementation for class methods: https://gist.github.com/314009

提交回复
热议问题