Skip to content

Instantly share code, notes, and snippets.

@moonglum
Created March 15, 2012 08:44
Show Gist options
  • Save moonglum/2043015 to your computer and use it in GitHub Desktop.
Save moonglum/2043015 to your computer and use it in GitHub Desktop.
How I would test a HTTP Interface
source :rubygems
gem "httparty", "~> 0.8.1"
gem "rspec", "~> 2.8.0"
require 'httparty'
class Github
include HTTParty
base_uri 'https://api.github.com'
format :json
end
require 'rspec'
require './github.rb'
describe Github do
describe "/users/moonglum/gists" do
before do
@list_of_gists = Github.get("/users/moonglum/gists")
end
it "should at least contain 5 gists" do
@list_of_gists.length >= 5
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment