restful-matchers Build Status Code Climate

RSpec matchers to test RESTful resource links. Currently it supports only JSON representations with an array of link objects with rel and href attributes, like this:

{
  "attribute1": "value1",
  "attribute2": "value2",
  "links": [
    { "rel": "self", "href": "http://example.com" }
  ]
}

Example:

describe MyRestfulController do
  render_views

  it "should have entry-point links" do
    get :index
    response.body.should have_restful_json_link("self", "http://example.com")
    response.body.should have_restful_json_link("resource1", "http://example.com/resource1")
    response.body.should have_restful_json_link("resource2", "http://example.com/resource2")
  end
end