I couldn't find a way to check a string that was passed to a function with toHaveBeenCalledWith, using a regexp.
In particular, I'm passing URL with timestamp, and I'd like to validate it with something like
In code I have:
GET('/post?' + (new Date()).getTime())
In test want to do something like:
Is there any way to do this or, at least, check a string argument with regexp?
I am not sure whether @pivotal will see this issue, but in the meantime, you may use Spy#mostRecentCall.args in combination with the Matchers#toMatch regexp matcher to accomplish this.
I have created a stackoverflow question about this.
Would something like this be OK:
Using something like jasmine.any here makes things simpler at implementation time.
We've made a tracker story for this. You can follow along here: https://www.pivotaltracker.com/story/show/58120558
Thanks for the heads up @slackersoft. 👍
Add asymmetric equality tester to match a string against a regexp
- Also move the asymmetric testers into their own dir for easier
[#58120558] Fix #243