link_oracle 0.1.6 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5037a462b2f18aa3bf1f4ea925c3cefb1697e46a
4
- data.tar.gz: 824da5dd8ae7e12a8e5c412151c145866641f961
3
+ metadata.gz: d19780fb7f9cd2688937b8cc94e32f3c82b514ac
4
+ data.tar.gz: d4ebf911932fc368456526e26c19544b8e843762
5
5
  SHA512:
6
- metadata.gz: 17b1f57667b2b5b5470408b6edb9ef46196da92a6a96ba67f98c1e1c70d6d4e51f062890c15e353c4636dadc504b70c50509a83d910b17c188ac87e921547c39
7
- data.tar.gz: 675f26ded878ecce2d5d179f12c7f81a2f10e251001d8b693fb37945ce2c8b8a0b2f8aca145dbff49139b81dfdd8e5765ffadb77ab96dfc2a6ffc9a472a7b92c
6
+ metadata.gz: 36a66ac4d7f24a076fff08a21e892f365d8749da383cf3e006340c73fda2fb8f3ee4a0a626720561001850523c4e1dd3d176197656a5b0a9511279329ddb7d7c
7
+ data.tar.gz: d30bbc6cbbd2abf2f2eb397b0648f6ee1921793d55e715ceb51cbeab4e751e413a7ec446c25b9a6e4e3426a8b6f86710b24f4f8e28d4fb7de0dcea54ac0c1f4e
@@ -50,6 +50,8 @@ class LinkOracle
50
50
  c.perform
51
51
  end
52
52
  c
53
+ rescue Curl::Err::HostResolutionError
54
+ raise ServerNotFound
53
55
  end
54
56
 
55
57
  def error_class
@@ -68,6 +70,7 @@ class LinkOracle
68
70
  end
69
71
 
70
72
  class PageNotFound < StandardError; end
73
+ class ServerNotFound < StandardError; end
71
74
  class PermissionDenied < StandardError; end
72
75
  class BadThingsHappened < StandardError; end
73
76
  class InvalidUrl < StandardError; end
@@ -1,3 +1,3 @@
1
1
  class LinkOracle
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
@@ -26,14 +26,13 @@ describe LinkOracle::Request do
26
26
  </html>"
27
27
  }
28
28
 
29
-
30
- describe 'perform' do
29
+ describe '#parsed_url' do
31
30
  context 'request failures' do
32
31
  before do
33
32
  stub_request(:any, url).to_return(response_hash)
34
33
  end
35
34
 
36
- context 'invalid url' do
35
+ context 'page not found' do
37
36
  context 'response code is 404' do
38
37
  let(:code) { 404 }
39
38
 
@@ -44,6 +43,18 @@ describe LinkOracle::Request do
44
43
  end
45
44
  end
46
45
 
46
+ context 'nonexistant url' do
47
+ it 'should raise ServerNotFound' do
48
+ curl = double('curl', "follow_location=" => true, "max_redirects=" => true)
49
+ allow(curl).to receive(:perform).and_raise(Curl::Err::HostResolutionError)
50
+ allow(Curl::Easy).to receive(:new).and_return(curl)
51
+
52
+ expect {
53
+ requester.parsed_url
54
+ }.to raise_error(LinkOracle::ServerNotFound)
55
+ end
56
+ end
57
+
47
58
  context 'response code is 403' do
48
59
  let(:code) { 403 }
49
60
 
@@ -100,12 +111,16 @@ describe LinkOracle::Request do
100
111
  end
101
112
 
102
113
  context "the url has weird characters in it" do
114
+ before do
115
+ stub_request(:any, url).to_return(response_hash)
116
+ end
117
+
103
118
  let(:url) { 'http://www.autoblog.com/2014/09/26/porsche-911-nissan-gtr-world-greatest-drag-race-video/?icid=autos|latest-auto-news|content' }
104
119
 
105
120
  it "should encode and not raise an error" do
106
121
  expect {
107
122
  requester.parsed_url
108
- }.to_not raise_error(LinkOracle::InvalidUrl)
123
+ }.to_not raise_error
109
124
  end
110
125
  end
111
126
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: link_oracle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian Cooper
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2014-10-20 00:00:00.000000000 Z
16
+ date: 2014-11-11 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: nokogiri