Brightify / Cuckoo

Boilerplate-free mocking framework for Swift!
MIT License
1.67k stars 174 forks source link

Installing > 2.0 version #525

Open Dancargon opened 1 week ago

Dancargon commented 1 week ago

Hi! I've installed Cocoapod version 2.0.9. It generates the GeneratedMocks file but It fails to compile with a message:

Global function 'when' requires that 'MockGraphQlClientProtocol.Stubbing' (aka 'MockGraphQlClientProtocol.__StubbingProxy_GraphQlClientProtocol') conform to 'BaseStubFunctionTrait'

on all instances of when similar to this:

graphQlClientMock = MockGraphQlClientProtocol()
stub(graphQlClientMock) { stub in
    when(stub).setup(withSession: any(), serverUrlString: any()).thenDoNothing()
}

MockGraphQlClientProtocol seems to be generated successfully in the GeneratedMocks file.

Any feedback will be much appreciated.

Thanks!

MatyasKriz commented 2 days ago

Hey, Cuckoo 1 allowed an unintentional syntax of when(stub).method(...).thenX, but Cuckoo 2 enforces the intended syntax of when(stub.method(...)).thenX.

Basically the method call needs to be inside the when call, not after it.

Dancargon commented 1 day ago

Thanks, it's fixed. Much appreciated!