Monday, January 28, 2013
Useful Tools for Testing Web API
1. RSpec HTTP : https://github.com/c42/rspec-http
response.should be_http_ok
response.should be_http_created
response.should be_http_unprocessable_entity
response.should be_http_im_a_teapot
response.should have_header('Content-Type')
response.should have_header('Content-Type' => 'application/json')
response.should have_header('Content-Type' => /json/)
2. JSON Spec : https://github.com/collectiveidea/json_spec
json_spec defines five new RSpec matchers:
be_json_eql
include_json
have_json_path
have_json_type
have_json_size
3. VCR : https://github.com/myronmarston/vcr
Screencast on VCR : http://avdi.org/devblog/2011/04/11/screencast-taping-api-interactions-with-vcr/