After some research, I settled (for now) to use Cucumber, json_spec and cucumber-api-steps.
These allow me to write this kind of test against the API:
Feature: User API
Background:
Given the following users exist:
| id | name | password | email |
| 1 | ben | abcdef | ben@email.com |
| 2 | jon | bcdefg | jon@email.com |
When I sign in as "ben@email.com/abcdef"
And I send and accept JSON
Scenario: GET /users
When I send a GET request for "/users"
Then the response status should be "200"
And the JSON should be:
"""
[
{
"email": "ben@email.com",
"name": "ben"
},
{
"email": "jon@email.com",
"name": "jon"
}
]
"""
And the JSON at "0/name" should be "ben"
Scenario: GET users/1
When I send a GET request for "/users/1"
Then the response status should be "200"
And the JSON should be:
"""
{
"email": "ben@email.com",
"name": "ben"
}
"""
And the JSON at "name" should be "ben"