-
Notifications
You must be signed in to change notification settings - Fork 140
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
Checking that a method was called twice with different values #326
Comments
There were some recent changes to be more strict with passed types. What happens if you cast the argument to with() to the exact numeric type being passed to the method? Yes, there currently isn't a matcher for this, but it certainly would be a welcome addition. For now I have filed a feature request in Cedar's public tracker: https://www.pivotaltracker.com/story/show/94038932 Alternatively, you can perform the assertions more directly on the messages captured by any double object by accessing them via |
I was able to get the sent_messages and use that to verify that I was getting the correct values, but there really should be a better way to validate multiple messages and their parameters. Thanks for the help. |
I agree, this should be supported. I just tried to reproduce the issue you described, but wasn't able to do so. What is the declared type of the argument in your example? Here are the specs I added in HaveReceivedSpec.mm in Cedar's own spec suite:
|
Oh, I realized it right after posting. It appears to be an This probably boils down to a failure to match floating point numbers. The equality matcher has the same problem, which is the reason for |
As to the other question, how about |
Would it be possible to extend the have_received function with an index, so that the .with() behavior worked as well? I think we may have written (not gracefully) a wrapper of some kind to do this at one point.
|
They are different values. these code snippets were additions to cedar's own test suite. On Thu, May 7, 2015 at 6:47 AM, Jamie Riley Evans
|
Adding a method that takes an
The literal 5 is implicitly an |
I like the idea of having this |
I'm trying to verify that a method gets called twice with specific values, but I can't seem to verify both calls, just the first. I have verified that the method is called twice and that the values are correct, but I'm not sure how to write the cedar spec.
Here is what I have:
The error I'm getting is this:
Also, it doesn't seem you can verify that a method was called a specific number of times without overriding the invocation and tracking the count.
The text was updated successfully, but these errors were encountered: