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

README.md example not working as expected #45

Closed
brycefisher opened this issue Oct 14, 2015 · 3 comments
Closed

README.md example not working as expected #45

brycefisher opened this issue Oct 14, 2015 · 3 comments

Comments

@brycefisher
Copy link

I want to mock out a method that needs to respond with different return values and make assertions about its parameters. The example in the README looked like it does exactly what I want. However, I was unable to get mockery (or Testify more accurately) to run my lambda function and return its return values.

Here's the closest I could come to following the instructions:
https://github.com/brycefisher/mockerytest

Am I doing something wrong here? It feels like I'm following the directions from the README. Thanks for your help!!

@brycefisher brycefisher changed the title README.md Return Value Provider seems wrong README.md example not working as expected Oct 14, 2015
@evanphx
Copy link
Member

evanphx commented Apr 7, 2016

Ok, I see what you did. The example is wrong because it's expecting an argument as well, if you make it just Passthrough() string it will work. Otherwise you can also pass in a string like .On("Passthrough", "whatever").

@evanphx
Copy link
Member

evanphx commented Apr 7, 2016

Actually, looking at the example again, it's correct as it's passing AnythingOfType("string") as the argument to passthrough, which is a magic type defined by github.com/stretchr/testify/mock.

@evanphx evanphx closed this as completed Apr 7, 2016
@brycefisher
Copy link
Author

Derrrr --- having more experience with testify mocks now, I see that this was a beginner mistake on my part. Apologies!

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

No branches or pull requests

2 participants