public
Rubygem
Description: Makes http fun! Also, makes consuming restful web services dead easy.
Homepage:
Clone URL: git://github.com/jnunemaker/httparty.git
Click here to lend your support to: httparty and make a donation at www.pledgie.com !
Fixed failing specs.
jnunemaker (author)
Tue Nov 11 20:27:58 -0800 2008
commit  9931e2a20dd579289407e28d1631ef319a5d3ad7
tree    22331d2d53930970dc63cd9121a3e9dceb60dff9
parent  e0cb4311d9a80bb3a44ac47e7355d2e24dc7307f
...
80
81
82
83
 
84
85
86
87
 
88
89
90
...
80
81
82
 
83
84
85
86
 
87
88
89
90
0
@@ -80,11 +80,11 @@ module HTTParty
0
     end
0
 
0
     private
0
-      def perform_request(http_method, path, options)
0
+      def perform_request(http_method, path, options) #:nodoc:
0
         Request.new(http_method, path, default_options.merge(options)).perform
0
       end
0
     
0
-      # Makes it so uri is sure to parse stuff like google.com with the http
0
+      # Makes it so uri is sure to parse stuff like google.com without the http
0
       def normalize_base_uri(url) #:nodoc:
0
         use_ssl = (url =~ /^https/) || url.include?(':443')
0
         url.chop! if url.ends_with?('/')
...
37
38
39
40
 
41
42
43
 
44
45
46
47
48
49
 
50
51
52
...
74
75
76
77
 
78
79
80
81
82
83
 
84
85
86
87
88
89
 
90
91
92
93
94
95
 
96
97
98
99
100
101
102
 
103
104
105
...
37
38
39
 
40
41
42
 
43
44
45
46
47
48
49
50
51
52
53
...
75
76
77
 
78
79
80
81
82
83
 
84
85
86
87
88
89
 
90
91
92
93
94
95
 
96
97
98
99
100
101
102
 
103
104
105
106
0
@@ -37,16 +37,17 @@ describe HTTParty::Request do
0
     http.stub!(:request).and_return(response)
0
 
0
     @request.options[:format] = :xml
0
-    @request.send_request.should be_nil
0
+    @request.perform.should be_nil
0
 
0
     response.stub!(:body).and_return("")
0
-    @request.send_request.should be_nil
0
+    @request.perform.should be_nil
0
   end
0
 
0
   describe "that respond with redirects" do
0
     def setup_redirect
0
       @http = Net::HTTP.new('localhost', 80)
0
       @request.stub!(:http).and_return(@http)
0
+      @request.stub!(:uri).and_return(URI.parse("http://foo.com/foobar"))
0
       @redirect = Net::HTTPFound.new("1.1", 302, "")
0
       @redirect['location'] = '/foo'
0
     end
0
@@ -74,32 +75,32 @@ describe HTTParty::Request do
0
 
0
     it "should handle redirects for GET transparently" do
0
       setup_successful_redirect
0
-      @request.send_request.should == {"hash" => {"foo" => "bar"}}
0
+      @request.perform.should == {"hash" => {"foo" => "bar"}}
0
     end
0
 
0
     it "should handle redirects for POST transparently" do
0
       setup_successful_redirect
0
       @request.http_method = Net::HTTP::Post
0
-      @request.send_request.should == {"hash" => {"foo" => "bar"}}
0
+      @request.perform.should == {"hash" => {"foo" => "bar"}}
0
     end
0
 
0
     it "should handle redirects for DELETE transparently" do
0
       setup_successful_redirect
0
       @request.http_method = Net::HTTP::Delete
0
-      @request.send_request.should == {"hash" => {"foo" => "bar"}}
0
+      @request.perform.should == {"hash" => {"foo" => "bar"}}
0
     end
0
 
0
     it "should handle redirects for PUT transparently" do
0
       setup_successful_redirect
0
       @request.http_method = Net::HTTP::Put
0
-      @request.send_request.should == {"hash" => {"foo" => "bar"}}
0
+      @request.perform.should == {"hash" => {"foo" => "bar"}}
0
     end
0
 
0
     it "should prevent infinite loops" do
0
       setup_infinite_redirect
0
 
0
       lambda do
0
-        @request.send_request
0
+        @request.perform
0
       end.should raise_error(HTTParty::RedirectionTooDeep)
0
     end
0
   end
...
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
...
90
91
92
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
94
95
0
@@ -90,26 +90,6 @@ describe HTTParty do
0
       end.should raise_error(HTTParty::UnsupportedFormat)
0
     end
0
   end
0
-  
0
-  describe "sending requests" do
0
-    it "should not work with request method other than get, post, put, delete" do
0
-      lambda do
0
-        Foo.send(:send_request, 'foo', '/foo')
0
-      end.should raise_error(ArgumentError)
0
-    end
0
-    
0
-    it 'should require that :headers is a hash if present' do
0
-      lambda do
0
-        Foo.send(:send_request, 'get', '/foo', :headers => 'string')
0
-      end.should raise_error(ArgumentError)
0
-    end
0
-    
0
-    it 'should require that :basic_auth is a hash if present' do
0
-      lambda do
0
-        Foo.get('/foo', :basic_auth => 'string')
0
-      end.should raise_error(ArgumentError)
0
-    end
0
-  end
0
 
0
   describe "with explicit override of automatic redirect handling" do
0
 

Comments