Ignore JSON keys order when stubbing a request
When stubbing a request with a json body, the actual request has to have the exact same string representation of json in order to work. So, for example
stub_request(:post,'www.example.com').with(body: {key1: 'value1,key2: 'value2'}.to_json)
will not be matched by
POST www.example.com
"
{
"key2" : "value2",
"key1" : "value1"
}
"
Would be better to parse both JSON (request and stub_request) in hashes and make the comparison ignoring the keys order.
I have noticed the same things just now. Including what @maxdidato is suggesting would be nice. :+1:
Any update on that? I would be happy to provide a solution if the issue makes any sense.
+1
this is coming up next on my list, need to fix some code around the same area first, and then tackle this.