Add proxy support

This commit is contained in:
Joe Martinez 2009-01-10 22:52:08 -05:00 committed by Chris Anderson
parent 6b57357fc0
commit 108ec0a28e
2 changed files with 15 additions and 0 deletions

View file

@ -78,6 +78,11 @@ module CouchRest
}
end
# set proxy for RestClient to use
def proxy url
RestClient.proxy = url
end
# ensure that a database exists
# creates it if it isn't already there
# returns it after it's been created

View file

@ -188,4 +188,14 @@ describe CouchRest do
end
end
describe "using a proxy for RestClient connections" do
it "should set proxy url for RestClient" do
CouchRest.proxy 'http://localhost:8888/'
proxy_uri = URI.parse(RestClient.proxy)
proxy_uri.host.should eql( 'localhost' )
proxy_uri.port.should eql( 8888 )
CouchRest.proxy nil
end
end
end