8000 GitHub - bcm/rspec-http: RSpec HTTP is an extension library that makes it easier to write specs for HTTP/REST APIs
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

bcm/rspec-http

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RSpec HTTP 0.10.0

© Copyright 2010-2011 C42 Engineering. All Rights Reserved.

RSpec HTTP is a RSpec extension library that adds support for writing specs that cover HTTP based APIs (or more popularly, RESTful APIs).

To use this library, first add the rspec-http gem to your Gemfile like so:

gem 'rspec-http', '~> 0.9'

Then add the following line to your spec_helper.rb:

require 'rspec/http'

This will make matchers such as the ones listed below available to you in your specs.

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/)

Rails

If you’re using Rails (and implicitly, rspec-rails), the same http code matchers will also be available in your controller specs without the http namespace. In other words, in your controller specs you can do:

response.should be_ok

response.should be_created

response.should be_unprocessable_entity

response.should be_im_a_teapot

About

RSpec HTTP is an extension library that makes it easier to write specs for HTTP/REST APIs

Resources

License

Stars

Watchers

Forks

Packages

No packages published
0