|
31 | 31 | options[:timeout].should == 10
|
32 | 32 | options[:redis_options].should == {}
|
33 | 33 | options[:internal_urls].should == []
|
| 34 | + options[:proxy_addr].should be_nil |
| 35 | + options[:proxy_port].should be_nil |
34 | 36 |
|
35 | 37 | end
|
36 | 38 |
|
|
177 | 179 | end
|
178 | 180 | describe "location setting" do
|
179 | 181 | it "Get should strip fragments" do
|
180 |
| - Net::HTTP.should_receive(:new).with("www.google.com", 80) |
| 182 | + Net::HTTP.should_receive(:new).with("www.google.com", 80, nil, nil) |
181 | 183 | Net::HTTP::Get.should_receive(:new).with("/", @default_options)
|
182 | 184 | @cobweb.get("http://www.google.com/#ignore")
|
183 | 185 | end
|
184 | 186 | it "head should strip fragments" do
|
185 |
| - Net::HTTP.should_receive(:new).with("www.google.com", 80) |
| 187 | + Net::HTTP.should_receive(:new).with("www.google.com", 80, nil, nil) |
186 | 188 | Net::HTTP::Head.should_receive(:new).with("/", {}).and_return(@mock_http_request)
|
187 | 189 | @cobweb.head("http://www.google.com/#ignore")
|
188 | 190 | end
|
189 | 191 | it "get should not strip path" do
|
190 |
| - Net::HTTP.should_receive(:new).with("www.google.com", 80) |
| 192 | + Net::HTTP.should_receive(:new).with("www.google.com", 80, nil, nil) |
191 | 193 | Net::HTTP::Get.should_receive(:new).with("/path/to/stuff", @default_options)
|
192 | 194 | @cobweb.get("http://www.google.com/path/to/stuff#ignore")
|
193 | 195 | end
|
194 | 196 | it "get should not strip query string" do
|
195 |
| - Net::HTTP.should_receive(:new).with("www.google.com", 80) |
| 197 | + Net::HTTP.should_receive(:new).with("www.google.com", 80, nil, nil) |
196 | 198 | Net::HTTP::Get.should_receive(:new).with("/path/to/stuff?query_string", @default_options)
|
197 | 199 | @cobweb.get("http://www.google.com/path/to/stuff?query_string#ignore")
|
198 | 200 | end
|
199 | 201 | end
|
| 202 | + describe "with proxy" do |
| 203 | + it "provides proxy parameters to Net::HTTP" do |
| 204 | + cobweb = Cobweb.new proxy_addr: 'proxy.example.com', proxy_port: 1234 |
| 205 | + Net::HTTP.should_receive(:new).with("www.google.com", 80, "proxy.example.com", 1234) |
| 206 | + |
| 207 | + cobweb.get("http://www.google.com/") |
| 208 | + end |
| 209 | + end |
200 | 210 |
|
201 | 211 | end
|
202 | 212 | end
|
0 commit comments