Closed lstebner closed 4 years ago
When calling thing:doStuff(whatStuff)
, you're actually calling doStuff
like this thing.doStuff(thing, whatStuff)
.
I adjusted the check to assert.spy(thing.thing2.doStuff).was_called_with(thing.thing2, whatStuff)
and it worked.
@Le0Developer ahh, i should have thought of that! that actually makes a lot of sense, thank you very much for figuring that out. i won't get to try this out in my other project until much later tonight, but that sounds like it'll fix it for sure so i will close this issue.
Hello, I am trying to spy on a method in a codebase where I am using lua's class style syntax, but using
was_called_with
is not ever working. When I change tests towas_called()
they are fine, and when I inspect the spy I can see the expected argument in the calls, but yetwas_called_with
always says that the function was not called with expected arguments. I'm not finding any other people having this issue, so it could be just me, but I was able to set up a repo with a minimal amount of code that recreates my situation to help diagnose: https://github.com/lstebner/lua-busted-busteda sidenote (which I did see brought up elsewhere) is that this failure message could be much more helpful by telling me what arguments it did get called with: "./thing_spec.lua:27: Function was not called with the arguments".
thank you in advance for any help!