Skip to content

mad-p/capybara-json

 
 

Repository files navigation

capybara-json Build Status Dependency Status

testing ruby: 1.9.2, 1.9.3 and ruby-head; Capybara: < 1.0 and > 1.0

About capybara-json

capybara-json provides the same interface to testing JSON API (both local and remote)

Capybara is an acceptance test framework, and it has no interest with client error(4xx response).

USAGE

require 'capybara/json'
include Capybara::Json

Capybara.current_driver = :rack_test_json
post '/', { "this is" => "json" } # POST '/'
json   #=> parsed json response
source #=> raw response body
get  '/errors/400'
status_code #=> 400
get! '/errors' #=> raise Capybara::Json::Error

Capybara.current_driver = :httpclient_json
Capybara.app_host = 'http://example.com'
post '/', { "this is" => "json" } # POST 'http://example.com/'
json   #=> parsed json response
source #=> raw response body
get  '/errors/400'
status_code #=> 400
get! '/errors' #=> raise Capybara::Json::Error

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 99.8%
  • Perl 0.2%