Validate that the input to remember will not try to use the numeric % #91
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The code in JsonSpec.remember assumes that the incoming argument will be a string and uses the % operator to interpolate from the memory hash into the string. However, it is perfectly possible to pass in a Numeric type (e.g. Fixnum) for which the % operator means something totally different which causes the code to try to convert the hash to fixnum, which it can't. This is especially problematic from the cucumber matchers, where your input is always run through remember.
I ran into the problem when trying to do a cucumber step like "And the JSON at "count" should be 10" but I am completely unable to reproduce it in this repo's cucumber tests (the 10 always comes in as a string some way I don't understand).
It appears possible to fix this either by doing .to_s on the income argument or changing the exclusion criteria to also include .is_a?(Numeric) (i.e. in addition to checking if the memory hash is empty). I think the is numeric check is more precise, so I'll submit a pull request with that change, but both solve my particular problem.