erikdoe / ocmock

Mock objects for Objective-C
http://ocmock.org
Apache License 2.0
2.16k stars 606 forks source link

Error in partial mock documentation #528

Closed Arthur-Milchior closed 1 year ago

Arthur-Milchior commented 1 year ago

In https://ocmock.org/reference/ you wrote:

When a method is stubbed and that method is invoked using a reference to the real object, the mock will still be able to handle the invocation. Similarly, when a method is invoked using a reference to anObject, rather than the mock, it can still be verified later.

I believe that anObject is the real object. So your sentence is repeating twice the same thing. Instead, I suspect that something such as

When a method myMethod is stubbed, both [anObject myMethod] and [partialMock myMethod] will use the mocked method, and can be verified later.

Relatedly: I’d have sens this as a PR, but I can’t figure out where the documentation is hosted, if anywhere; that may also be interesting to document

erikdoe commented 1 year ago

Agreed, the sentences are a little awkward, but they're not repeating the same statement. The first sentence says that when you use the real object the mock is able to "handle" the invocation. That's meant to say any stub that's set up will be used. The second sentence says that when you use the real object you can verify that the method was invoked. The confusion likely arises because "handle" can be understood to imply that you can verify later. I'll make a fix.

The documentation is hosted via GitHub pages. It is in a branch named gh-pages. That's standard GitHub functionality, but maybe not well known.