polipus 0.0.4 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/spec/http_spec.rb CHANGED
@@ -48,6 +48,27 @@ describe Polipus::HTTP do
48
48
  http.proxy_host.should eq "127.0.0.0"
49
49
  end
50
50
 
51
+ describe 'staled connections' do
52
+
53
+ it 'should refresh a staled connection' do
54
+
55
+ VCR.use_cassette('http_tconnection_max_hits') do
56
+ http = Polipus::HTTP.new(connection_max_hits: 1, logger: Logger.new(STDOUT))
57
+ http.class.__send__(:attr_reader, :connections)
58
+ http.class.__send__(:attr_reader, :connections_hits)
59
+ http.fetch_page("https://www.yahoo.com/")
60
+ http.connections['www.yahoo.com'][443].should_not be_nil
61
+ old_conn = http.connections['www.yahoo.com'][443]
62
+ http.connections_hits['www.yahoo.com'][443].should be 1
63
+
64
+ http.fetch_page("https://www.yahoo.com/tech/expectant-parents-asked-the-internet-to-name-their-83416450388.html")
65
+ http.connections_hits['www.yahoo.com'][443].should be 1
66
+ http.connections['www.yahoo.com'][443].should_not be old_conn
67
+
68
+ end
69
+ end
70
+ end
71
+
51
72
  end
52
73
 
53
74
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: polipus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Francesco Laurita
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-21 00:00:00.000000000 Z
11
+ date: 2014-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis-bloomfilter
@@ -320,6 +320,7 @@ files:
320
320
  - spec/cassettes/ab333f89535a2efb284913fede6aa7c7.yml
321
321
  - spec/cassettes/ae5d7cffde3f53122cdf79f3d1367e8e.yml
322
322
  - spec/cassettes/ffe3d588b6df4b9de35e5a7ccaf5a81b.yml
323
+ - spec/cassettes/http_tconnection_max_hits.yml
323
324
  - spec/cassettes/http_test.yml
324
325
  - spec/cassettes/http_test_redirect.yml
325
326
  - spec/clear.rb
@@ -365,6 +366,7 @@ test_files:
365
366
  - spec/cassettes/ab333f89535a2efb284913fede6aa7c7.yml
366
367
  - spec/cassettes/ae5d7cffde3f53122cdf79f3d1367e8e.yml
367
368
  - spec/cassettes/ffe3d588b6df4b9de35e5a7ccaf5a81b.yml
369
+ - spec/cassettes/http_tconnection_max_hits.yml
368
370
  - spec/cassettes/http_test.yml
369
371
  - spec/cassettes/http_test_redirect.yml
370
372
  - spec/clear.rb