Nocilla icon indicating copy to clipboard operation
Nocilla copied to clipboard

OCMock 3 #define andReturn(), as a result, calling andReturn() will return an error.

Open patcheng opened this issue 11 years ago • 4 comments

so, created an alias that OCMock is not touching

Based on https://github.com/moneytree/Nocilla/commit/f8291740558f88abd8fee5250977b3cb3fcd610c

patcheng avatar Dec 03 '14 20:12 patcheng

Some minor feedback on the API for the status code.

What do you think of calling it withStatusCode? It would fit in nicely with other DSL methods like withHeaders and withBody.

Just a thought. Thanks for opening a pull request on this. I was just about to start digging into the issue.

novak avatar Dec 07 '14 02:12 novak

I think the "addReturn" separates withHeaders for the request, vs withHeaders for the response.

stubRequest(@"POST", @"https://api.example.com/dogs.json").
withHeaders(@{@"Accept": @"application/json", @"X-CUSTOM-HEADER": @"abcf2fbc6abgf"}).
withBody(@"^The body start with this".regex).
andReturnWithStatusCode(200).
withHeaders(@{@"Content-Type": @"application/json"});

vs

stubRequest(@"POST", @"https://api.example.com/dogs.json").
withHeaders(@{@"Accept": @"application/json", @"X-CUSTOM-HEADER": @"abcf2fbc6abgf"}).
withBody(@"^The body start with this".regex).
withStatusCode(200).
withHeaders(@{@"Content-Type": @"application/json"});

@luisobo ?

patcheng avatar Dec 07 '14 19:12 patcheng

@patcheng good point, that does break it up nicely.

novak avatar Dec 07 '14 20:12 novak

Any update on this pull request? Maybe @luisobo or @patcheng?

rpranata avatar Jan 04 '17 21:01 rpranata