xenda-typhoeus 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. data/.gitignore +4 -0
  2. data/CHANGELOG.markdown +70 -0
  3. data/Gemfile +3 -0
  4. data/Gemfile.lock +38 -0
  5. data/LICENSE +20 -0
  6. data/README.textile +397 -0
  7. data/Rakefile +56 -0
  8. data/VERSION +1 -0
  9. data/benchmarks/profile.rb +25 -0
  10. data/benchmarks/vs_nethttp.rb +35 -0
  11. data/examples/file.rb +12 -0
  12. data/examples/times.rb +40 -0
  13. data/examples/twitter.rb +21 -0
  14. data/ext/typhoeus/.gitignore +7 -0
  15. data/ext/typhoeus/extconf.rb +65 -0
  16. data/ext/typhoeus/native.c +12 -0
  17. data/ext/typhoeus/native.h +22 -0
  18. data/ext/typhoeus/typhoeus_easy.c +232 -0
  19. data/ext/typhoeus/typhoeus_easy.h +20 -0
  20. data/ext/typhoeus/typhoeus_form.c +59 -0
  21. data/ext/typhoeus/typhoeus_form.h +13 -0
  22. data/ext/typhoeus/typhoeus_multi.c +217 -0
  23. data/ext/typhoeus/typhoeus_multi.h +16 -0
  24. data/lib/typhoeus.rb +58 -0
  25. data/lib/typhoeus/.gitignore +1 -0
  26. data/lib/typhoeus/easy.rb +379 -0
  27. data/lib/typhoeus/filter.rb +28 -0
  28. data/lib/typhoeus/form.rb +32 -0
  29. data/lib/typhoeus/hydra.rb +247 -0
  30. data/lib/typhoeus/hydra/callbacks.rb +24 -0
  31. data/lib/typhoeus/hydra/connect_options.rb +61 -0
  32. data/lib/typhoeus/hydra/stubbing.rb +52 -0
  33. data/lib/typhoeus/hydra_mock.rb +131 -0
  34. data/lib/typhoeus/multi.rb +37 -0
  35. data/lib/typhoeus/normalized_header_hash.rb +58 -0
  36. data/lib/typhoeus/remote.rb +306 -0
  37. data/lib/typhoeus/remote_method.rb +108 -0
  38. data/lib/typhoeus/remote_proxy_object.rb +50 -0
  39. data/lib/typhoeus/request.rb +203 -0
  40. data/lib/typhoeus/response.rb +91 -0
  41. data/lib/typhoeus/service.rb +20 -0
  42. data/lib/typhoeus/utils.rb +63 -0
  43. data/profilers/valgrind.rb +24 -0
  44. data/spec/fixtures/placeholder.gif +0 -0
  45. data/spec/fixtures/placeholder.txt +1 -0
  46. data/spec/fixtures/placeholder.ukn +0 -0
  47. data/spec/fixtures/result_set.xml +60 -0
  48. data/spec/servers/app.rb +94 -0
  49. data/spec/spec.opts +3 -0
  50. data/spec/spec_helper.rb +14 -0
  51. data/spec/typhoeus/easy_spec.rb +343 -0
  52. data/spec/typhoeus/filter_spec.rb +35 -0
  53. data/spec/typhoeus/form_spec.rb +117 -0
  54. data/spec/typhoeus/hydra_mock_spec.rb +300 -0
  55. data/spec/typhoeus/hydra_spec.rb +574 -0
  56. data/spec/typhoeus/multi_spec.rb +74 -0
  57. data/spec/typhoeus/normalized_header_hash_spec.rb +41 -0
  58. data/spec/typhoeus/remote_method_spec.rb +141 -0
  59. data/spec/typhoeus/remote_proxy_object_spec.rb +65 -0
  60. data/spec/typhoeus/remote_spec.rb +695 -0
  61. data/spec/typhoeus/request_spec.rb +300 -0
  62. data/spec/typhoeus/response_spec.rb +151 -0
  63. data/spec/typhoeus/utils_spec.rb +22 -0
  64. data/xenda-typhoeus.gemspec +139 -0
  65. metadata +203 -0
@@ -0,0 +1,574 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ # some of these tests assume that you have some local services running.
4
+ # ruby spec/servers/app.rb -p 3000
5
+ # ruby spec/servers/app.rb -p 3001
6
+ # ruby spec/servers/app.rb -p 3002
7
+ describe Typhoeus::Hydra do
8
+ before(:all) do
9
+ cache_class = Class.new do
10
+ def initialize
11
+ @cache = {}
12
+ end
13
+ def get(key)
14
+ @cache[key]
15
+ end
16
+ def set(key, object, timeout = 0)
17
+ @cache[key] = object
18
+ end
19
+ end
20
+ @cache = cache_class.new
21
+ end
22
+
23
+ it "has a singleton" do
24
+ Typhoeus::Hydra.hydra.should be_a Typhoeus::Hydra
25
+ end
26
+
27
+ it "has a setter for the singleton" do
28
+ Typhoeus::Hydra.hydra = :foo
29
+ Typhoeus::Hydra.hydra.should == :foo
30
+ Typhoeus::Hydra.hydra = Typhoeus::Hydra.new
31
+ end
32
+
33
+ it "queues a request" do
34
+ hydra = Typhoeus::Hydra.new
35
+ hydra.queue Typhoeus::Request.new("http://localhost:3000")
36
+ end
37
+
38
+ it "runs a batch of requests" do
39
+ hydra = Typhoeus::Hydra.new
40
+ first = Typhoeus::Request.new("http://localhost:3000/first")
41
+ second = Typhoeus::Request.new("http://localhost:3001/second")
42
+ hydra.queue first
43
+ hydra.queue second
44
+ hydra.run
45
+ first.response.body.should include("first")
46
+ second.response.body.should include("second")
47
+ end
48
+
49
+ it "runs queued requests in order of queuing" do
50
+ hydra = Typhoeus::Hydra.new :max_concurrency => 1
51
+ first = Typhoeus::Request.new("http://localhost:3000/first")
52
+ second = Typhoeus::Request.new("http://localhost:3001/second")
53
+ third = Typhoeus::Request.new("http://localhost:3001/third")
54
+ second.on_complete do |response|
55
+ first.response.should_not == nil
56
+ third.response.should == nil
57
+ end
58
+ third.on_complete do |response|
59
+ first.response.should_not == nil
60
+ second.response.should_not == nil
61
+ end
62
+
63
+ hydra.queue first
64
+ hydra.queue second
65
+ hydra.queue third
66
+ hydra.run
67
+ first.response.body.should include("first")
68
+ second.response.body.should include("second")
69
+ third.response.body.should include("third")
70
+ end
71
+
72
+ it "should store the curl return codes on the reponses" do
73
+ hydra = Typhoeus::Hydra.new
74
+ first = Typhoeus::Request.new("http://localhost:3001/?delay=1", :timeout => 100)
75
+ second = Typhoeus::Request.new("http://localhost:3999", :connect_timout => 100)
76
+ hydra.queue first
77
+ hydra.queue second
78
+ hydra.run
79
+ first.response.curl_return_code == 28
80
+ second.response.curl_return_code == 7
81
+ end
82
+
83
+ it "aborts a batch of requests" do
84
+ urls = [
85
+ 'http://localhost:3000',
86
+ 'http://localhost:3001',
87
+ 'http://localhost:3002'
88
+ ]
89
+
90
+ # this will make testing easier
91
+ hydra = Typhoeus::Hydra.new( :max_concurrency => 1 )
92
+ completed = 0
93
+
94
+ 10.times {
95
+ |i|
96
+
97
+ req = Typhoeus::Request.new( urls[ i % urls.size], :params => { :cnt => i } )
98
+ req.on_complete {
99
+ |res|
100
+ completed += 1
101
+ hydra.abort if completed == 5
102
+ }
103
+
104
+ hydra.queue( req )
105
+ }
106
+
107
+ hydra.run
108
+
109
+ # technically this should be '== 6' but I don't trust it...
110
+ completed.should < 10
111
+ end
112
+
113
+ it "has a cache_setter proc" do
114
+ hydra = Typhoeus::Hydra.new
115
+ hydra.cache_setter do |request|
116
+ # @cache.set(request.cache_key, request.response, request.cache_timeout)
117
+ end
118
+ end
119
+
120
+ it "has a cache_getter" do
121
+ hydra = Typhoeus::Hydra.new
122
+ hydra.cache_getter do |request|
123
+ # @cache.get(request.cache_key) rescue nil
124
+ end
125
+ end
126
+
127
+ it "memoizes GET reqeusts" do
128
+ hydra = Typhoeus::Hydra.new
129
+ first = Typhoeus::Request.new("http://localhost:3000/foo", :params => {:delay => 1})
130
+ second = Typhoeus::Request.new("http://localhost:3000/foo", :params => {:delay => 1})
131
+ hydra.queue first
132
+ hydra.queue second
133
+ start_time = Time.now
134
+ hydra.run
135
+ first.response.body.should include("foo")
136
+ first.handled_response.body.should include("foo")
137
+ first.response.should == second.response
138
+ first.handled_response.should == second.handled_response
139
+ (Time.now - start_time).should < 1.2 # if it had run twice it would be ~ 2 seconds
140
+ end
141
+
142
+ it "can turn off memoization for GET requests" do
143
+ hydra = Typhoeus::Hydra.new
144
+ hydra.disable_memoization
145
+ first = Typhoeus::Request.new("http://localhost:3000/foo")
146
+ second = Typhoeus::Request.new("http://localhost:3000/foo")
147
+ hydra.queue first
148
+ hydra.queue second
149
+ hydra.run
150
+ first.response.body.should include("foo")
151
+ first.response.object_id.should_not == second.response.object_id
152
+ end
153
+
154
+ it "pulls GETs from cache" do
155
+ hydra = Typhoeus::Hydra.new
156
+ start_time = Time.now
157
+ hydra.cache_getter do |request|
158
+ @cache.get(request.cache_key) rescue nil
159
+ end
160
+ hydra.cache_setter do |request|
161
+ @cache.set(request.cache_key, request.response, request.cache_timeout)
162
+ end
163
+
164
+ first = Typhoeus::Request.new("http://localhost:3000/foo", :params => {:delay => 1})
165
+ @cache.set(first.cache_key, :foo, 60)
166
+ hydra.queue first
167
+ hydra.run
168
+ (Time.now - start_time).should < 0.1
169
+ first.response.should == :foo
170
+ end
171
+
172
+ it "sets GET responses to cache when the request has a cache_timeout value" do
173
+ hydra = Typhoeus::Hydra.new
174
+ hydra.cache_getter do |request|
175
+ @cache.get(request.cache_key) rescue nil
176
+ end
177
+ hydra.cache_setter do |request|
178
+ @cache.set(request.cache_key, request.response, request.cache_timeout)
179
+ end
180
+
181
+ first = Typhoeus::Request.new("http://localhost:3000/first", :cache_timeout => 0)
182
+ second = Typhoeus::Request.new("http://localhost:3000/second")
183
+ hydra.queue first
184
+ hydra.queue second
185
+ hydra.run
186
+ first.response.body.should include("first")
187
+ @cache.get(first.cache_key).should == first.response
188
+ @cache.get(second.cache_key).should be_nil
189
+ end
190
+
191
+ it "continues queued requests after a queued cache hit" do
192
+ # Set max_concurrency to 1 so that the second and third requests will end
193
+ # up in the request queue.
194
+ hydra = Typhoeus::Hydra.new :max_concurrency => 1
195
+ hydra.cache_getter do |request|
196
+ @cache.get(request.cache_key) rescue nil
197
+ end
198
+ hydra.cache_setter do |request|
199
+ @cache.set(request.cache_key, request.response, request.cache_timeout)
200
+ end
201
+
202
+ first = Typhoeus::Request.new("http://localhost:3000/first", :params => {:delay => 1})
203
+ second = Typhoeus::Request.new("http://localhost:3000/second", :params => {:delay => 1})
204
+ third = Typhoeus::Request.new("http://localhost:3000/third", :params => {:delay => 1})
205
+ @cache.set(second.cache_key, "second", 60)
206
+ hydra.queue first
207
+ hydra.queue second
208
+ hydra.queue third
209
+ hydra.run
210
+
211
+ first.response.body.should include("first")
212
+ second.response.should == "second"
213
+ third.response.body.should include("third")
214
+ end
215
+
216
+ it "has a global on_complete" do
217
+ foo = nil
218
+ hydra = Typhoeus::Hydra.new
219
+ hydra.on_complete do |response|
220
+ foo = :called
221
+ end
222
+
223
+ first = Typhoeus::Request.new("http://localhost:3000/first")
224
+ hydra.queue first
225
+ hydra.run
226
+ first.response.body.should include("first")
227
+ foo.should == :called
228
+ end
229
+
230
+ it "has a global on_complete setter" do
231
+ foo = nil
232
+ hydra = Typhoeus::Hydra.new
233
+ proc = Proc.new {|response| foo = :called}
234
+ hydra.on_complete = proc
235
+
236
+ first = Typhoeus::Request.new("http://localhost:3000/first")
237
+ hydra.queue first
238
+ hydra.run
239
+ first.response.body.should include("first")
240
+ foo.should == :called
241
+ end
242
+
243
+ it "should reuse connections from the pool for a host"
244
+
245
+ it "should queue up requests while others are running" do
246
+ hydra = Typhoeus::Hydra.new
247
+
248
+ start_time = Time.now
249
+ @responses = []
250
+
251
+ request = Typhoeus::Request.new("http://localhost:3000/first", :params => {:delay => 1})
252
+ request.on_complete do |response|
253
+ @responses << response
254
+ response.body.should include("first")
255
+ end
256
+
257
+ request.after_complete do |object|
258
+ second_request = Typhoeus::Request.new("http://localhost:3001/second", :params => {:delay => 2})
259
+ second_request.on_complete do |response|
260
+ @responses << response
261
+ response.body.should include("second")
262
+ end
263
+ hydra.queue second_request
264
+ end
265
+ hydra.queue request
266
+
267
+ third_request = Typhoeus::Request.new("http://localhost:3002/third", :params => {:delay => 3})
268
+ third_request.on_complete do |response|
269
+ @responses << response
270
+ response.body.should include("third")
271
+ end
272
+ hydra.queue third_request
273
+
274
+ hydra.run
275
+ @responses.size.should == 3
276
+ (Time.now - start_time).should < 3.3
277
+ end
278
+
279
+ it "should fire and forget" do
280
+ # this test is totally hacky. I have no clue how to make it verify. I just look at the test servers
281
+ # to verify that stuff is running
282
+ hydra = Typhoeus::Hydra.new
283
+ first = Typhoeus::Request.new("http://localhost:3000/first?delay=1")
284
+ second = Typhoeus::Request.new("http://localhost:3001/second?delay=2")
285
+ hydra.queue first
286
+ hydra.queue second
287
+ hydra.fire_and_forget
288
+ third = Typhoeus::Request.new("http://localhost:3002/third?delay=3")
289
+ hydra.queue third
290
+ hydra.fire_and_forget
291
+ sleep 3 # have to do this or future tests may break.
292
+ end
293
+
294
+ it "should take the maximum number of concurrent requests as an argument" do
295
+ hydra = Typhoeus::Hydra.new(:max_concurrency => 2)
296
+ first = Typhoeus::Request.new("http://localhost:3000/first?delay=1")
297
+ second = Typhoeus::Request.new("http://localhost:3001/second?delay=1")
298
+ third = Typhoeus::Request.new("http://localhost:3002/third?delay=1")
299
+ hydra.queue first
300
+ hydra.queue second
301
+ hydra.queue third
302
+
303
+ start_time = Time.now
304
+ hydra.run
305
+ finish_time = Time.now
306
+
307
+ first.response.code.should == 200
308
+ second.response.code.should == 200
309
+ third.response.code.should == 200
310
+ (finish_time - start_time).should > 2.0
311
+ end
312
+
313
+ it "should respect the follow_location option when set on a request" do
314
+ hydra = Typhoeus::Hydra.new
315
+ request = Typhoeus::Request.new("http://localhost:3000/redirect", :follow_location => true)
316
+ hydra.queue request
317
+ hydra.run
318
+
319
+ request.response.code.should == 200
320
+ end
321
+
322
+ it "should pass through the max_redirects option when set on a request" do
323
+ hydra = Typhoeus::Hydra.new
324
+ request = Typhoeus::Request.new("http://localhost:3000/bad_redirect", :max_redirects => 5)
325
+ hydra.queue request
326
+ hydra.run
327
+
328
+ request.response.code.should == 302
329
+ end
330
+ end
331
+
332
+ describe Typhoeus::Hydra::Stubbing do
333
+ shared_examples_for "any stubbable target" do
334
+ before(:each) do
335
+ @on_complete_handler_called = nil
336
+ @request = Typhoeus::Request.new("http://localhost:3000/foo",
337
+ :user_agent => 'test')
338
+ @request.on_complete do |response|
339
+ @on_complete_handler_called = true
340
+ response.code.should == 404
341
+ response.headers.should == "whatever"
342
+ end
343
+ @response = Typhoeus::Response.new(:code => 404,
344
+ :headers => "whatever",
345
+ :body => "not found",
346
+ :time => 0.1)
347
+ end
348
+
349
+ after(:each) do
350
+ @stub_target.clear_stubs
351
+ end
352
+
353
+ it "should provide a stubs accessor" do
354
+ begin
355
+ @stub_target.stubs.should == []
356
+ @stub_target.stubs = [:foo]
357
+ ensure
358
+ @stub_target.clear_stubs
359
+ end
360
+ end
361
+
362
+ it "stubs requests to a specific URI" do
363
+ @stub_target.stub(:get, "http://localhost:3000/foo",
364
+ :headers => { 'user-agent' => 'test'}).
365
+ and_return(@response)
366
+
367
+ @hydra.queue(@request)
368
+ @hydra.run
369
+ @on_complete_handler_called.should be_true
370
+ @response.request.should == @request
371
+ end
372
+
373
+ it "stubs requests to URIs matching a pattern" do
374
+ @stub_target.stub(:get, /foo/,
375
+ :headers => { 'user-agent' => 'test' }).
376
+ and_return(@response)
377
+ @hydra.queue(@request)
378
+ @hydra.run
379
+ @on_complete_handler_called.should be_true
380
+ @response.request.should == @request
381
+ end
382
+
383
+ it "can clear stubs" do
384
+ @stub_target.clear_stubs
385
+ end
386
+
387
+ it "clears out previously queued requests once they are called" do
388
+ @stub_target.stub(:get, "http://localhost:3000/asdf",
389
+ :headers => { 'user-agent' => 'test' }).
390
+ and_return(@response)
391
+
392
+ call_count = 0
393
+ request = Typhoeus::Request.new("http://localhost:3000/asdf", :user_agent => 'test')
394
+ request.on_complete do |response|
395
+ call_count += 1
396
+ end
397
+ @hydra.queue(request)
398
+ @hydra.run
399
+ call_count.should == 1
400
+ @hydra.run
401
+ call_count.should == 1
402
+ end
403
+
404
+ it "calls stubs for requests that are queued up in the on_complete of a first stub" do
405
+ @stub_target.stub(:get, "http://localhost:3000/asdf").and_return(@response)
406
+ @stub_target.stub(:get, "http://localhost:3000/bar").and_return(@response)
407
+
408
+ second_handler_called = false
409
+ request = Typhoeus::Request.new("http://localhost:3000/asdf")
410
+ request.on_complete do |response|
411
+ r = Typhoeus::Request.new("http://localhost:3000/bar")
412
+ r.on_complete do |res|
413
+ second_handler_called = true
414
+ end
415
+ @hydra.queue(r)
416
+ end
417
+ @hydra.queue(request)
418
+ @hydra.run
419
+
420
+ second_handler_called.should be_true
421
+ end
422
+ end
423
+
424
+ describe "global (class-level) stubbing" do
425
+ before(:each) do
426
+ @hydra = Typhoeus::Hydra.new
427
+ @stub_target = Typhoeus::Hydra
428
+ end
429
+
430
+ it_should_behave_like "any stubbable target"
431
+ end
432
+
433
+ describe "instance stubbing" do
434
+ before(:each) do
435
+ @hydra = Typhoeus::Hydra.new
436
+ @stub_target = @hydra
437
+ end
438
+
439
+ it_should_behave_like "any stubbable target"
440
+ end
441
+ end
442
+
443
+ describe Typhoeus::Hydra::Callbacks do
444
+ before(:all) do
445
+ @klass = Typhoeus::Hydra
446
+ end
447
+
448
+ describe "#after_request_before_on_complete" do
449
+ it "should provide a global hook after a request" do
450
+ begin
451
+ http_method = nil
452
+ @klass.after_request_before_on_complete do |request|
453
+ http_method = request.method
454
+ end
455
+
456
+ hydra = @klass.new
457
+ request = Typhoeus::Request.new('http://localhost:3000',
458
+ :method => :get)
459
+ response = Typhoeus::Response.new(:code => 404,
460
+ :headers => "whatever",
461
+ :body => "not found",
462
+ :time => 0.1)
463
+ hydra.stub(:get, 'http://localhost:3000').
464
+ and_return(response)
465
+
466
+ hydra.queue(request)
467
+ hydra.run
468
+
469
+ http_method.should == :get
470
+ ensure
471
+ @klass.clear_global_hooks
472
+ end
473
+ end
474
+ end
475
+ end
476
+
477
+ describe Typhoeus::Hydra::ConnectOptions do
478
+ before(:all) do
479
+ @klass = Typhoeus::Hydra
480
+ end
481
+
482
+ let!(:old_net_connect) { @klass.allow_net_connect }
483
+ let!(:old_ignore_localhost) { @klass.ignore_localhost }
484
+ let(:hydra) { @klass.new }
485
+
486
+ after(:each) do
487
+ @klass.allow_net_connect = old_net_connect
488
+ @klass.ignore_localhost = old_ignore_localhost
489
+ end
490
+
491
+ def request_for(host)
492
+ Typhoeus::Request.new("http://#{host}:3000")
493
+ end
494
+
495
+ describe "#ignore_localhost" do
496
+ context "when set to true" do
497
+ before(:each) { @klass.ignore_localhost = true }
498
+
499
+ [true, false].each do |val|
500
+ it "allows localhost requests when allow_net_connect is #{val}" do
501
+ @klass.allow_net_connect = val
502
+ expect { hydra.queue(request_for('localhost')) }.to_not raise_error
503
+ end
504
+ end
505
+ end
506
+
507
+ context "when set to false" do
508
+ before(:each) { @klass.ignore_localhost = false }
509
+
510
+ it "allows localhost requests when allow_net_connect is true" do
511
+ @klass.allow_net_connect = true
512
+ expect { hydra.queue(request_for('localhost')) }.to_not raise_error
513
+ end
514
+
515
+ it "does not allow localhost requests when allow_net_connect is false" do
516
+ @klass.allow_net_connect = false
517
+ expect { hydra.queue(request_for('localhost')) }.to raise_error(Typhoeus::Hydra::NetConnectNotAllowedError)
518
+ end
519
+ end
520
+ end
521
+
522
+ describe "#ignore_hosts" do
523
+ context 'when allow_net_connect is set to false' do
524
+ before(:each) do
525
+ @klass.ignore_localhost = false
526
+ @klass.allow_net_connect = false
527
+ end
528
+
529
+ Typhoeus::Request::LOCALHOST_ALIASES.each do |disallowed_host|
530
+ ignore_hosts = Typhoeus::Request::LOCALHOST_ALIASES - [disallowed_host]
531
+
532
+ context "when set to #{ignore_hosts.join(' and ')}" do
533
+ before(:each) { @klass.ignore_hosts = ignore_hosts }
534
+
535
+ it "does not allow a request to #{disallowed_host}" do
536
+ expect { hydra.queue(request_for(disallowed_host)) }.to raise_error(Typhoeus::Hydra::NetConnectNotAllowedError)
537
+ end
538
+
539
+ ignore_hosts.each do |host|
540
+ it "allows a request to #{host}" do
541
+ expect { hydra.queue(request_for(host)) }.to_not raise_error
542
+ end
543
+ end
544
+ end
545
+ end
546
+ end
547
+ end
548
+
549
+ describe "#allow_net_connect" do
550
+ it "should be settable" do
551
+ @klass.allow_net_connect = true
552
+ @klass.allow_net_connect.should be_true
553
+ end
554
+
555
+ it "should default to true" do
556
+ @klass.allow_net_connect.should be_true
557
+ end
558
+
559
+ it "should raise an error if we queue a request while its false" do
560
+ @klass.allow_net_connect = false
561
+ @klass.ignore_localhost = false
562
+
563
+ expect {
564
+ hydra.queue(request_for('example.com'))
565
+ }.to raise_error(Typhoeus::Hydra::NetConnectNotAllowedError)
566
+ end
567
+ end
568
+
569
+ describe "#allow_net_connect?" do
570
+ it "should return true by default" do
571
+ @klass.allow_net_connect?.should be_true
572
+ end
573
+ end
574
+ end