Created
March 15, 2012 08:44
-
-
Save moonglum/2043015 to your computer and use it in GitHub Desktop.
How I would test a HTTP Interface
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source :rubygems | |
gem "httparty", "~> 0.8.1" | |
gem "rspec", "~> 2.8.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'httparty' | |
class Github | |
include HTTParty | |
base_uri 'https://api.github.com' | |
format :json | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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