Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

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