embiggen 1.2.5 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/embiggen/http_client.rb +8 -1
- data/shorteners.txt +1356 -0
- data/spec/embiggen/uri_spec.rb +7 -7
- metadata +3 -3
data/spec/embiggen/uri_spec.rb
CHANGED
@@ -89,7 +89,7 @@ module Embiggen
|
|
89
89
|
end
|
90
90
|
|
91
91
|
it 'raises an error if a shortened URI does not redirect' do
|
92
|
-
stub_request(:
|
92
|
+
stub_request(:get, 'http://bit.ly/bad').to_return(:status => 500)
|
93
93
|
uri = described_class.new('http://bit.ly/bad')
|
94
94
|
|
95
95
|
expect { uri.expand }.to raise_error(BadShortenedURI)
|
@@ -111,7 +111,7 @@ module Embiggen
|
|
111
111
|
|
112
112
|
it 'retains the last URI if a shortened URI does not redirect' do
|
113
113
|
stub_redirect('http://bit.ly/bad', 'http://bit.ly/bad2')
|
114
|
-
stub_request(:
|
114
|
+
stub_request(:get, 'http://bit.ly/bad2').to_return(:status => 500)
|
115
115
|
uri = described_class.new('http://bit.ly/bad')
|
116
116
|
|
117
117
|
last_uri = nil
|
@@ -126,21 +126,21 @@ module Embiggen
|
|
126
126
|
end
|
127
127
|
|
128
128
|
it 'raises a network error if the URI times out' do
|
129
|
-
stub_request(:
|
129
|
+
stub_request(:get, 'http://bit.ly/bad').to_timeout
|
130
130
|
uri = described_class.new('http://bit.ly/bad')
|
131
131
|
|
132
132
|
expect { uri.expand }.to raise_error(NetworkError)
|
133
133
|
end
|
134
134
|
|
135
135
|
it 'raises a network error if the connection resets' do
|
136
|
-
stub_request(:
|
136
|
+
stub_request(:get, 'http://bit.ly/bad').to_raise(::Errno::ECONNRESET)
|
137
137
|
uri = described_class.new('http://bit.ly/bad')
|
138
138
|
|
139
139
|
expect { uri.expand }.to raise_error(NetworkError)
|
140
140
|
end
|
141
141
|
|
142
142
|
it 'raises a network error if the host cannot be reached' do
|
143
|
-
stub_request(:
|
143
|
+
stub_request(:get, 'http://bit.ly/bad').to_raise(::Errno::EHOSTUNREACH)
|
144
144
|
uri = described_class.new('http://bit.ly/bad')
|
145
145
|
|
146
146
|
expect { uri.expand }.to raise_error(NetworkError)
|
@@ -148,7 +148,7 @@ module Embiggen
|
|
148
148
|
|
149
149
|
it 'retains the last URI if there is a network error' do
|
150
150
|
stub_redirect('http://bit.ly/bad', 'http://bit.ly/bad2')
|
151
|
-
stub_request(:
|
151
|
+
stub_request(:get, 'http://bit.ly/bad2').to_timeout
|
152
152
|
uri = described_class.new('http://bit.ly/bad')
|
153
153
|
|
154
154
|
begin
|
@@ -282,7 +282,7 @@ module Embiggen
|
|
282
282
|
end
|
283
283
|
|
284
284
|
def stub_redirect(short_url, expanded_url, status = 301)
|
285
|
-
stub_request(:
|
285
|
+
stub_request(:get, short_url).
|
286
286
|
to_return(:status => status, :headers => { 'Location' => expanded_url })
|
287
287
|
end
|
288
288
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embiggen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Mucur
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-07-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: addressable
|
@@ -95,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
95
|
version: '0'
|
96
96
|
requirements: []
|
97
97
|
rubyforge_project:
|
98
|
-
rubygems_version: 2.
|
98
|
+
rubygems_version: 2.6.11
|
99
99
|
signing_key:
|
100
100
|
specification_version: 4
|
101
101
|
summary: A library to expand shortened URLs
|