Predicates do not match ints, floats, booleans #4

Closed
bbyars opened this Issue Apr 24, 2014 · 2 comments

Projects

None yet

2 participants

@bbyars
Owner
bbyars commented Apr 24, 2014

One thing I ran into with configuring a stub was a predicate like this --

    {
      "deepEquals": {
        "path": "/imoji/index.php",
        "query": {
          "fb_id": 100
        },
        "method": "GET"
      }
    }

Initially I was surprised it never matched. Then I changed the query value to a string and it worked.

@moodmosaic
Contributor

As it looks like, that is happening because the expected and actual JSON string values are not equal:

expected "{"fb_id": 100 }"
  actual "{"fb_id":"100"}"

The actual value should be 100, not "100".

One option is to probably try fixing the actual value. Another option is to leave actual as-is and compare the object graphs semantically using objectdiff or something similar, I think.

@bbyars bbyars added a commit that referenced this issue May 6, 2014
@bbyars Changed test to verify predicates work with non-strings for predicates
other than deepEquals, in reseaching
#4
3b2b3fb
@bbyars
Owner
bbyars commented May 6, 2014

Fixed with 4fa7005

@bbyars bbyars closed this May 6, 2014
@bbyars bbyars added a commit that referenced this issue May 9, 2014
@bbyars Changed test to verify predicates work with non-strings for predicates
other than deepEquals, in reseaching
#4
f234af3
@bbyars bbyars added a commit that referenced this issue May 9, 2014
@moodmosaic @bbyars moodmosaic + Removed reference to issue #4 from TODO items
Removed reference to issue #4 from TODO items, since issue #4 is now resolved with [4fa7005](4fa7005).
75363fa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment