I'm using the "json_spec" gem in a Rails app and I'm trying to create some Cucumber steps to document/test my API code.
I have the following scenario:
Scenario: Create new authorization
Given an existing user and merchant
When I post to "/api/v1/authorizations.json" with:
"""
{"email":"user@email.com", "code": "43434", "merchant_account_id":1, "amount": 45.00}
"""
And I keep the JSON response at "authorization/id" as "AUTH_ID"
Then the JSON response should be:
"""
{"authorization":{"id":1,"email":"user@email.com","amount":45.0}}
"""
I expected "authorization/id" to give me the value of the "id" key in the "authorizations" hash. All the examples in the json_spec documentation contain arrays, but in this case the response only involves one entity--it would not make sense to have an array in the JSON. Is there a way to use paths when there is no array present?