Skip to content

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

Open
patcheng wants to merge 2 commits intolausobo:masterfrom
patcheng:feature/coexist_with_ocmock3
Open

OCMock 3 #define andReturn(), as a result, calling andReturn() will return an error.#95
patcheng wants to merge 2 commits intolausobo:masterfrom
patcheng:feature/coexist_with_ocmock3

Conversation

@patcheng
Copy link

@patcheng patcheng commented Dec 3, 2014

so, created an alias that OCMock is not touching

Based on moneytree@f829174

so, created an alias that OCMock is not touching

Based on moneytree@f829174
@novak
Copy link

novak commented Dec 7, 2014

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.

@patcheng
Copy link
Author

patcheng commented Dec 7, 2014

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 ?

@novak
Copy link

novak commented Dec 7, 2014

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

@rpranata
Copy link

rpranata commented Jan 4, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants