ruby-link-checker 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +3 -0
- data/CONTRIBUTING.md +125 -0
- data/Dangerfile +4 -0
- data/Gemfile +23 -0
- data/Gemfile.lock +162 -0
- data/LICENSE.md +22 -0
- data/README.md +279 -0
- data/RELEASING.md +60 -0
- data/Rakefile +18 -0
- data/benchmarks/check.rb +31 -0
- data/benchmarks/data/opensearch.org/links.txt +4270 -0
- data/benchmarks/data/opensearch.org/small.txt +100 -0
- data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_asc.png +0 -0
- data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_asc_disabled.png +0 -0
- data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_both.png +0 -0
- data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_desc.png +0 -0
- data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_desc_disabled.png +0 -0
- data/coverage/assets/0.12.3/application.css +1 -0
- data/coverage/assets/0.12.3/application.js +7 -0
- data/coverage/assets/0.12.3/colorbox/border.png +0 -0
- data/coverage/assets/0.12.3/colorbox/controls.png +0 -0
- data/coverage/assets/0.12.3/colorbox/loading.gif +0 -0
- data/coverage/assets/0.12.3/colorbox/loading_background.png +0 -0
- data/coverage/assets/0.12.3/favicon_green.png +0 -0
- data/coverage/assets/0.12.3/favicon_red.png +0 -0
- data/coverage/assets/0.12.3/favicon_yellow.png +0 -0
- data/coverage/assets/0.12.3/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/coverage/assets/0.12.3/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/coverage/assets/0.12.3/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/coverage/assets/0.12.3/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/coverage/assets/0.12.3/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/coverage/assets/0.12.3/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/coverage/assets/0.12.3/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/coverage/assets/0.12.3/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/coverage/assets/0.12.3/images/ui-icons_222222_256x240.png +0 -0
- data/coverage/assets/0.12.3/images/ui-icons_2e83ff_256x240.png +0 -0
- data/coverage/assets/0.12.3/images/ui-icons_454545_256x240.png +0 -0
- data/coverage/assets/0.12.3/images/ui-icons_888888_256x240.png +0 -0
- data/coverage/assets/0.12.3/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/coverage/assets/0.12.3/loading.gif +0 -0
- data/coverage/assets/0.12.3/magnify.png +0 -0
- data/coverage/index.html +14555 -0
- data/lib/ruby-link-checker/callbacks.rb +50 -0
- data/lib/ruby-link-checker/checker.rb +42 -0
- data/lib/ruby-link-checker/config.rb +41 -0
- data/lib/ruby-link-checker/errors/base_error.rb +8 -0
- data/lib/ruby-link-checker/errors/redirect_loop_error.rb +18 -0
- data/lib/ruby-link-checker/errors.rb +2 -0
- data/lib/ruby-link-checker/logger.rb +14 -0
- data/lib/ruby-link-checker/net/http/checker.rb +31 -0
- data/lib/ruby-link-checker/net/http/config.rb +35 -0
- data/lib/ruby-link-checker/net/http/result.rb +53 -0
- data/lib/ruby-link-checker/net/http.rb +3 -0
- data/lib/ruby-link-checker/result.rb +74 -0
- data/lib/ruby-link-checker/task.rb +20 -0
- data/lib/ruby-link-checker/tasks.rb +99 -0
- data/lib/ruby-link-checker/typhoeus/hydra/checker.rb +52 -0
- data/lib/ruby-link-checker/typhoeus/hydra/config.rb +35 -0
- data/lib/ruby-link-checker/typhoeus/hydra/result.rb +53 -0
- data/lib/ruby-link-checker/typhoeus/hydra.rb +3 -0
- data/lib/ruby-link-checker/version.rb +5 -0
- data/lib/ruby-link-checker.rb +13 -0
- data/lib/ruby_link_checker.rb +3 -0
- data/pkg/ruby-link-checker-0.1.0.gem +0 -0
- data/ruby-link-checker.gemspec +21 -0
- data/spec/fixtures/200.yml +65 -0
- data/spec/fixtures/301_200.yml +102 -0
- data/spec/fixtures/301_301.yml +114 -0
- data/spec/fixtures/301_400_301_200.yml +185 -0
- data/spec/fixtures/301_403.yml +78 -0
- data/spec/fixtures/404.yml +57 -0
- data/spec/fixtures/404_200.yml +89 -0
- data/spec/fixtures/404_404.yml +81 -0
- data/spec/fixtures/429_200.yml +135 -0
- data/spec/fixtures/429_429_200.yml +201 -0
- data/spec/ruby-link-checker/callbacks_spec.rb +43 -0
- data/spec/ruby-link-checker/checker_spec.rb +10 -0
- data/spec/ruby-link-checker/config_spec.rb +39 -0
- data/spec/ruby-link-checker/net/http/checker_spec.rb +61 -0
- data/spec/ruby-link-checker/typhoeus/hydra/checker_spec.rb +67 -0
- data/spec/ruby-link-checker/version_spec.rb +9 -0
- data/spec/spec_helper.rb +17 -0
- data/spec/support/config.rb +8 -0
- data/spec/support/link_checker.rb +322 -0
- data/spec/support/vcr.rb +13 -0
- data/spec/support/with_result.rb +15 -0
- data/spec/support/with_url.rb +14 -0
- metadata +144 -0
@@ -0,0 +1,67 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe LinkChecker::Typhoeus::Hydra::Checker do
|
6
|
+
module TestLinkChecker
|
7
|
+
class Task < LinkChecker::Typhoeus::Hydra::Task; end
|
8
|
+
|
9
|
+
class LinkChecker < LinkChecker::Typhoeus::Hydra::Checker
|
10
|
+
def check(url, options = {})
|
11
|
+
super url, options
|
12
|
+
@hydra.run
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
before :all do
|
17
|
+
VCR.configure do |config|
|
18
|
+
config.hook_into :typhoeus
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe TestLinkChecker::LinkChecker do
|
23
|
+
it_behaves_like 'a link checker'
|
24
|
+
|
25
|
+
context 'with timeout options', vcr: { cassette_name: '200' } do
|
26
|
+
before do
|
27
|
+
LinkChecker::Typhoeus::Hydra.configure do |config|
|
28
|
+
config.timeout = 5
|
29
|
+
config.connecttimeout = 10
|
30
|
+
end
|
31
|
+
expect(Typhoeus::Request).to receive(:new).with(
|
32
|
+
URI(url),
|
33
|
+
hash_including(timeout: 5, connecttimeout: 10)
|
34
|
+
).and_call_original
|
35
|
+
end
|
36
|
+
|
37
|
+
include_context 'with url'
|
38
|
+
|
39
|
+
it 'creates requests with a default timeout' do
|
40
|
+
expect(result.success?).to be true
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
context 'timeout', vcr: { cassette_name: '200' } do
|
45
|
+
before do
|
46
|
+
allow_any_instance_of(Typhoeus::Response).to receive(:timed_out?).and_return(true)
|
47
|
+
end
|
48
|
+
|
49
|
+
include_context 'with url'
|
50
|
+
|
51
|
+
it 'times out' do
|
52
|
+
expect(result.success?).to be false
|
53
|
+
expect(result.error?).to be true
|
54
|
+
expect(result.to_s).to eq 'GET https://www.example.org: ERROR (Timeout::Error)'
|
55
|
+
end
|
56
|
+
|
57
|
+
context 'with metadata' do
|
58
|
+
let(:options) { { foo: :bar } }
|
59
|
+
|
60
|
+
it 'times out' do
|
61
|
+
expect(result.error?).to be true
|
62
|
+
expect(result.options).to eq(foo: :bar)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
4
|
+
|
5
|
+
require 'rubygems'
|
6
|
+
|
7
|
+
require 'simplecov'
|
8
|
+
SimpleCov.start
|
9
|
+
|
10
|
+
require 'rspec'
|
11
|
+
require 'ruby-link-checker'
|
12
|
+
|
13
|
+
RSpec.configure(&:raise_errors_for_deprecations!)
|
14
|
+
|
15
|
+
Dir[File.join(File.dirname(__FILE__), 'support', '**/*.rb')].each do |file|
|
16
|
+
require file
|
17
|
+
end
|
@@ -0,0 +1,322 @@
|
|
1
|
+
shared_context 'a link checker' do
|
2
|
+
context 'user-agent' do
|
3
|
+
subject do
|
4
|
+
described_class.new(user_agent: 'user/agent')
|
5
|
+
end
|
6
|
+
|
7
|
+
it 'updates user-agent' do
|
8
|
+
expect(subject.user_agent).to eq 'user/agent'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
context 'check' do
|
13
|
+
let(:url) { 'https://www.example.org' }
|
14
|
+
|
15
|
+
include_context 'with result'
|
16
|
+
|
17
|
+
context 'with metadata' do
|
18
|
+
before do
|
19
|
+
subject.check(url, foo: 'bar')
|
20
|
+
end
|
21
|
+
|
22
|
+
context 'GET' do
|
23
|
+
subject do
|
24
|
+
described_class.new(methods: ['GET'])
|
25
|
+
end
|
26
|
+
|
27
|
+
context 'check' do
|
28
|
+
context '200', vcr: { cassette_name: '200' } do
|
29
|
+
it 'passes metadata' do
|
30
|
+
expect(result.options).to eq(foo: 'bar')
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
context '404', vcr: { cassette_name: '404' } do
|
35
|
+
it 'passes metadata' do
|
36
|
+
expect(result.options).to eq(foo: 'bar')
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
context 'error', vcr: { cassette_name: '404' } do
|
41
|
+
let(:url) { '\/invalid-url' }
|
42
|
+
|
43
|
+
it 'passes metadata' do
|
44
|
+
expect(result.options).to eq(foo: 'bar')
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
context 'a redirect loop', vcr: { cassette_name: '301+301' } do
|
49
|
+
it 'passes metadata' do
|
50
|
+
expect(result.options).to eq(foo: 'bar')
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
context 'without results' do
|
58
|
+
before do
|
59
|
+
subject.check(url, foo: 'bar')
|
60
|
+
end
|
61
|
+
|
62
|
+
context 'GET' do
|
63
|
+
subject do
|
64
|
+
described_class.new(results: false, methods: ['GET'])
|
65
|
+
end
|
66
|
+
|
67
|
+
context 'check' do
|
68
|
+
context 'a valid URI that returns a 200', vcr: { cassette_name: '200' } do
|
69
|
+
it 'passes metadata' do
|
70
|
+
expect(subject.results).to be_nil
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
context 'without metadata' do
|
78
|
+
before do
|
79
|
+
subject.check(url)
|
80
|
+
end
|
81
|
+
|
82
|
+
context 'GET' do
|
83
|
+
subject do
|
84
|
+
described_class.new(methods: ['GET'])
|
85
|
+
end
|
86
|
+
|
87
|
+
context 'check' do
|
88
|
+
context 'a valid URI that returns a 200', vcr: { cassette_name: '200' } do
|
89
|
+
it 'sets user agent' do
|
90
|
+
expect(result.request_headers['User-Agent']).to eq "Ruby Link Checker/#{LinkChecker::VERSION}"
|
91
|
+
end
|
92
|
+
|
93
|
+
it 'returns all metadata' do
|
94
|
+
expect(result.options).to eq({})
|
95
|
+
end
|
96
|
+
|
97
|
+
it 'returns results' do
|
98
|
+
expect(subject.results).to eq(
|
99
|
+
error: [],
|
100
|
+
failure: [],
|
101
|
+
success: [
|
102
|
+
result
|
103
|
+
]
|
104
|
+
)
|
105
|
+
end
|
106
|
+
|
107
|
+
it 'succeeds' do
|
108
|
+
expect(result.success?).to be true
|
109
|
+
expect(result.error?).to be false
|
110
|
+
expect(result.failure?).to be false
|
111
|
+
expect(result.uri).to eq URI(url)
|
112
|
+
expect(subject).to have_received(:called!).with(:result, result)
|
113
|
+
expect(subject).to have_received(:called!).with(:success, result)
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
context 'a 404', vcr: { cassette_name: '404', allow_playback_repeats: true } do
|
118
|
+
it 'fails' do
|
119
|
+
expect(result.success?).to be false
|
120
|
+
expect(result.error?).to be false
|
121
|
+
expect(result.failure?).to be true
|
122
|
+
expect(result.uri).to eq URI(url)
|
123
|
+
expect(result.response.code.to_i).to eq 404
|
124
|
+
expect(subject).to have_received(:called!).with(:failure, result)
|
125
|
+
end
|
126
|
+
|
127
|
+
context 'with 0 retries' do
|
128
|
+
subject do
|
129
|
+
described_class.new(methods: ['GET'], retries: 0)
|
130
|
+
end
|
131
|
+
|
132
|
+
it 'fails' do
|
133
|
+
expect(result.success?).to be false
|
134
|
+
expect(result.error?).to be false
|
135
|
+
expect(result.failure?).to be true
|
136
|
+
expect(result.uri).to eq URI(url)
|
137
|
+
expect(result.response.code.to_i).to eq 404
|
138
|
+
expect(subject).to have_received(:called!).with(:failure, result).once
|
139
|
+
expect(subject).not_to have_received(:called!).with(:retry, anything)
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
context 'with 1 retry' do
|
144
|
+
subject do
|
145
|
+
described_class.new(methods: ['GET'], retries: 1)
|
146
|
+
end
|
147
|
+
|
148
|
+
it 'fails' do
|
149
|
+
expect(result.success?).to be false
|
150
|
+
expect(result.error?).to be false
|
151
|
+
expect(result.failure?).to be true
|
152
|
+
expect(result.uri).to eq URI(url)
|
153
|
+
expect(result.response.code.to_i).to eq 404
|
154
|
+
expect(subject).to have_received(:called!).with(:failure, result).once
|
155
|
+
expect(subject).to have_received(:called!).with(:retry, anything).once
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
context 'with 2 retries' do
|
160
|
+
subject do
|
161
|
+
described_class.new(methods: ['GET'], retries: 2)
|
162
|
+
end
|
163
|
+
|
164
|
+
it 'fails' do
|
165
|
+
expect(result.success?).to be false
|
166
|
+
expect(result.error?).to be false
|
167
|
+
expect(result.failure?).to be true
|
168
|
+
expect(result.uri).to eq URI(url)
|
169
|
+
expect(result.response.code.to_i).to eq 404
|
170
|
+
expect(subject).to have_received(:called!).with(:failure, result).once
|
171
|
+
expect(subject).to have_received(:called!).with(:retry, anything).twice
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
context 'a redirect on HEAD followed by a 403', vcr: { cassette_name: '301+403' } do
|
177
|
+
it 'calls redirect callback' do
|
178
|
+
expect(result.success?).to be false
|
179
|
+
expect(result.failure?).to be true
|
180
|
+
expect(subject).to have_received(:called!).with(:redirect, anything)
|
181
|
+
expect(subject).to have_received(:called!).with(:failure, result).once
|
182
|
+
end
|
183
|
+
|
184
|
+
it 'reports its original and result urls' do
|
185
|
+
expect(result.uri.to_s).to eq url
|
186
|
+
expect(result.result_uri.to_s).not_to eq url
|
187
|
+
expect(result.result_uri.to_s).to eq 'https://www.dblock.org/'
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
context 'a redirect on HEAD followed by a 200', vcr: { cassette_name: '301+200' } do
|
192
|
+
it 'calls redirect callback' do
|
193
|
+
expect(result.success?).to be true
|
194
|
+
expect(result.failure?).to be false
|
195
|
+
expect(result.redirect?).to be false
|
196
|
+
expect(subject).to have_received(:called!).with(:redirect, anything)
|
197
|
+
expect(subject).to have_received(:called!).with(:success, result)
|
198
|
+
expect(subject).not_to have_received(:called!).with(:failure, anything)
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
context 'a redirect loop', vcr: { cassette_name: '301+301' } do
|
203
|
+
it 'calls redirect callback' do
|
204
|
+
expect(result.success?).to be false
|
205
|
+
expect(result.failure?).to be false
|
206
|
+
expect(result.error?).to be true
|
207
|
+
expect(result.error).to be_a LinkChecker::Errors::RedirectLoopError
|
208
|
+
expect(result.redirect?).to be false
|
209
|
+
expect(subject).to have_received(:called!).with(:redirect, anything).twice
|
210
|
+
expect(subject).to have_received(:called!).with(:error, result)
|
211
|
+
expect(subject).not_to have_received(:called!).with(:failure, result)
|
212
|
+
expect(subject).not_to have_received(:called!).with(:success, result)
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
context 'a retry on 429', vcr: {
|
217
|
+
cassette_name: '429+200',
|
218
|
+
match_requests_on: [lambda { |_request, recorded_request|
|
219
|
+
@matched ||= []
|
220
|
+
if @matched.size + 1 === recorded_request.headers['Index'].first
|
221
|
+
@matched << recorded_request
|
222
|
+
true
|
223
|
+
else
|
224
|
+
false
|
225
|
+
end
|
226
|
+
}]
|
227
|
+
} do
|
228
|
+
subject do
|
229
|
+
described_class.new(methods: ['GET'], retries: 1)
|
230
|
+
end
|
231
|
+
|
232
|
+
it 'calls a retry callback' do
|
233
|
+
expect(result.success?).to be true
|
234
|
+
expect(result.failure?).to be false
|
235
|
+
expect(result.redirect?).to be false
|
236
|
+
expect(subject).to have_received(:called!).with(:retry, anything)
|
237
|
+
expect(subject).to have_received(:called!).with(:success, result)
|
238
|
+
expect(subject).not_to have_received(:called!).with(:failure, anything)
|
239
|
+
expect(subject).not_to have_received(:called!).with(:error, anything)
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
context 'an invalid URI' do
|
244
|
+
let(:url) { '\/invalid-url' }
|
245
|
+
|
246
|
+
it 'fails' do
|
247
|
+
expect(result.success?).to be false
|
248
|
+
expect(result.failure?).to be false
|
249
|
+
expect(result.error?).to be true
|
250
|
+
expect(result.uri).to eq url
|
251
|
+
expect(subject).to have_received(:called!).with(:result, result)
|
252
|
+
expect(subject).to have_received(:called!).with(:error, result)
|
253
|
+
expect(subject).not_to have_received(:called!).with(:failure)
|
254
|
+
expect(subject).not_to have_received(:called!).with(:success)
|
255
|
+
end
|
256
|
+
end
|
257
|
+
end
|
258
|
+
|
259
|
+
context 'HEAD,GET' do
|
260
|
+
subject do
|
261
|
+
described_class.new(methods: %w[HEAD GET])
|
262
|
+
end
|
263
|
+
|
264
|
+
context 'a valid URI that fails on HEAD and succeeds on GET', vcr: { cassette_name: '404+200' } do
|
265
|
+
it 'succeeds' do
|
266
|
+
expect(result.success?).to be true
|
267
|
+
expect(result.error?).to be false
|
268
|
+
expect(result.failure?).to be false
|
269
|
+
expect(result.uri).to eq URI(url)
|
270
|
+
expect(subject).to have_received(:called!).with(:success, result)
|
271
|
+
expect(subject).not_to have_received(:called!).with(:failure, result)
|
272
|
+
end
|
273
|
+
end
|
274
|
+
|
275
|
+
context 'a valid URI that fails both on HEAD and GET', vcr: { cassette_name: '404+404' } do
|
276
|
+
it 'fails' do
|
277
|
+
expect(result.success?).to be false
|
278
|
+
expect(result.error?).to be false
|
279
|
+
expect(result.failure?).to be true
|
280
|
+
expect(result.uri).to eq URI(url)
|
281
|
+
expect(result.response.code.to_i).to eq 404
|
282
|
+
expect(subject).to have_received(:called!).with(:failure, result).once
|
283
|
+
end
|
284
|
+
end
|
285
|
+
|
286
|
+
context 'a retry on 429', vcr: {
|
287
|
+
cassette_name: '429+429+200',
|
288
|
+
match_requests_on: [lambda { |request, recorded_request|
|
289
|
+
@matched ||= []
|
290
|
+
if recorded_request.method == request.method && @matched.size + 1 === recorded_request.headers['Index'].first
|
291
|
+
@matched << recorded_request
|
292
|
+
true
|
293
|
+
else
|
294
|
+
false
|
295
|
+
end
|
296
|
+
}]
|
297
|
+
} do
|
298
|
+
subject do
|
299
|
+
described_class.new(methods: %w[HEAD GET], retries: 1)
|
300
|
+
end
|
301
|
+
|
302
|
+
it 'executes HEAD twice, then falls back to GET' do
|
303
|
+
expect(result.success?).to be true
|
304
|
+
end
|
305
|
+
end
|
306
|
+
|
307
|
+
context 'a redirect on HEAD followed by a 400 error succeeds on GET',
|
308
|
+
vcr: { cassette_name: '301+400+301+200' } do
|
309
|
+
it 'calls redirect callback' do
|
310
|
+
expect(result.success?).to be true
|
311
|
+
expect(result.failure?).to be false
|
312
|
+
expect(result.redirect?).to be false
|
313
|
+
expect(subject).to have_received(:called!).with(:redirect, anything).twice
|
314
|
+
expect(subject).to have_received(:called!).with(:success, result).once
|
315
|
+
expect(subject).not_to have_received(:called!).with(:failure, anything)
|
316
|
+
end
|
317
|
+
end
|
318
|
+
end
|
319
|
+
end
|
320
|
+
end
|
321
|
+
end
|
322
|
+
end
|
data/spec/support/vcr.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'vcr'
|
4
|
+
require 'webmock/rspec'
|
5
|
+
|
6
|
+
VCR.configure do |config|
|
7
|
+
config.cassette_library_dir = 'spec/fixtures'
|
8
|
+
# config.default_cassette_options = { record: :new_episodes }
|
9
|
+
config.configure_rspec_metadata!
|
10
|
+
config.before_record do |i|
|
11
|
+
i.response.body.force_encoding('UTF-8')
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
shared_context 'with result' do
|
2
|
+
before do
|
3
|
+
allow(subject).to receive(:called!)
|
4
|
+
subject.on do |event, *data|
|
5
|
+
subject.called! event, *data
|
6
|
+
end
|
7
|
+
subject.on :result do |result|
|
8
|
+
@result = result
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
let(:result) do
|
13
|
+
@result
|
14
|
+
end
|
15
|
+
end
|
metadata
ADDED
@@ -0,0 +1,144 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ruby-link-checker
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Daniel Doubrovkine
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-04-02 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: typhoeus
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description:
|
28
|
+
email: dblock@dblock.org
|
29
|
+
executables: []
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files: []
|
32
|
+
files:
|
33
|
+
- CHANGELOG.md
|
34
|
+
- CONTRIBUTING.md
|
35
|
+
- Dangerfile
|
36
|
+
- Gemfile
|
37
|
+
- Gemfile.lock
|
38
|
+
- LICENSE.md
|
39
|
+
- README.md
|
40
|
+
- RELEASING.md
|
41
|
+
- Rakefile
|
42
|
+
- benchmarks/check.rb
|
43
|
+
- benchmarks/data/opensearch.org/links.txt
|
44
|
+
- benchmarks/data/opensearch.org/small.txt
|
45
|
+
- coverage/assets/0.12.3/DataTables-1.10.20/images/sort_asc.png
|
46
|
+
- coverage/assets/0.12.3/DataTables-1.10.20/images/sort_asc_disabled.png
|
47
|
+
- coverage/assets/0.12.3/DataTables-1.10.20/images/sort_both.png
|
48
|
+
- coverage/assets/0.12.3/DataTables-1.10.20/images/sort_desc.png
|
49
|
+
- coverage/assets/0.12.3/DataTables-1.10.20/images/sort_desc_disabled.png
|
50
|
+
- coverage/assets/0.12.3/application.css
|
51
|
+
- coverage/assets/0.12.3/application.js
|
52
|
+
- coverage/assets/0.12.3/colorbox/border.png
|
53
|
+
- coverage/assets/0.12.3/colorbox/controls.png
|
54
|
+
- coverage/assets/0.12.3/colorbox/loading.gif
|
55
|
+
- coverage/assets/0.12.3/colorbox/loading_background.png
|
56
|
+
- coverage/assets/0.12.3/favicon_green.png
|
57
|
+
- coverage/assets/0.12.3/favicon_red.png
|
58
|
+
- coverage/assets/0.12.3/favicon_yellow.png
|
59
|
+
- coverage/assets/0.12.3/images/ui-bg_flat_0_aaaaaa_40x100.png
|
60
|
+
- coverage/assets/0.12.3/images/ui-bg_flat_75_ffffff_40x100.png
|
61
|
+
- coverage/assets/0.12.3/images/ui-bg_glass_55_fbf9ee_1x400.png
|
62
|
+
- coverage/assets/0.12.3/images/ui-bg_glass_65_ffffff_1x400.png
|
63
|
+
- coverage/assets/0.12.3/images/ui-bg_glass_75_dadada_1x400.png
|
64
|
+
- coverage/assets/0.12.3/images/ui-bg_glass_75_e6e6e6_1x400.png
|
65
|
+
- coverage/assets/0.12.3/images/ui-bg_glass_95_fef1ec_1x400.png
|
66
|
+
- coverage/assets/0.12.3/images/ui-bg_highlight-soft_75_cccccc_1x100.png
|
67
|
+
- coverage/assets/0.12.3/images/ui-icons_222222_256x240.png
|
68
|
+
- coverage/assets/0.12.3/images/ui-icons_2e83ff_256x240.png
|
69
|
+
- coverage/assets/0.12.3/images/ui-icons_454545_256x240.png
|
70
|
+
- coverage/assets/0.12.3/images/ui-icons_888888_256x240.png
|
71
|
+
- coverage/assets/0.12.3/images/ui-icons_cd0a0a_256x240.png
|
72
|
+
- coverage/assets/0.12.3/loading.gif
|
73
|
+
- coverage/assets/0.12.3/magnify.png
|
74
|
+
- coverage/index.html
|
75
|
+
- lib/ruby-link-checker.rb
|
76
|
+
- lib/ruby-link-checker/callbacks.rb
|
77
|
+
- lib/ruby-link-checker/checker.rb
|
78
|
+
- lib/ruby-link-checker/config.rb
|
79
|
+
- lib/ruby-link-checker/errors.rb
|
80
|
+
- lib/ruby-link-checker/errors/base_error.rb
|
81
|
+
- lib/ruby-link-checker/errors/redirect_loop_error.rb
|
82
|
+
- lib/ruby-link-checker/logger.rb
|
83
|
+
- lib/ruby-link-checker/net/http.rb
|
84
|
+
- lib/ruby-link-checker/net/http/checker.rb
|
85
|
+
- lib/ruby-link-checker/net/http/config.rb
|
86
|
+
- lib/ruby-link-checker/net/http/result.rb
|
87
|
+
- lib/ruby-link-checker/result.rb
|
88
|
+
- lib/ruby-link-checker/task.rb
|
89
|
+
- lib/ruby-link-checker/tasks.rb
|
90
|
+
- lib/ruby-link-checker/typhoeus/hydra.rb
|
91
|
+
- lib/ruby-link-checker/typhoeus/hydra/checker.rb
|
92
|
+
- lib/ruby-link-checker/typhoeus/hydra/config.rb
|
93
|
+
- lib/ruby-link-checker/typhoeus/hydra/result.rb
|
94
|
+
- lib/ruby-link-checker/version.rb
|
95
|
+
- lib/ruby_link_checker.rb
|
96
|
+
- pkg/ruby-link-checker-0.1.0.gem
|
97
|
+
- ruby-link-checker.gemspec
|
98
|
+
- spec/fixtures/200.yml
|
99
|
+
- spec/fixtures/301_200.yml
|
100
|
+
- spec/fixtures/301_301.yml
|
101
|
+
- spec/fixtures/301_400_301_200.yml
|
102
|
+
- spec/fixtures/301_403.yml
|
103
|
+
- spec/fixtures/404.yml
|
104
|
+
- spec/fixtures/404_200.yml
|
105
|
+
- spec/fixtures/404_404.yml
|
106
|
+
- spec/fixtures/429_200.yml
|
107
|
+
- spec/fixtures/429_429_200.yml
|
108
|
+
- spec/ruby-link-checker/callbacks_spec.rb
|
109
|
+
- spec/ruby-link-checker/checker_spec.rb
|
110
|
+
- spec/ruby-link-checker/config_spec.rb
|
111
|
+
- spec/ruby-link-checker/net/http/checker_spec.rb
|
112
|
+
- spec/ruby-link-checker/typhoeus/hydra/checker_spec.rb
|
113
|
+
- spec/ruby-link-checker/version_spec.rb
|
114
|
+
- spec/spec_helper.rb
|
115
|
+
- spec/support/config.rb
|
116
|
+
- spec/support/link_checker.rb
|
117
|
+
- spec/support/vcr.rb
|
118
|
+
- spec/support/with_result.rb
|
119
|
+
- spec/support/with_url.rb
|
120
|
+
homepage: http://github.com/dblock/ruby-link-checker
|
121
|
+
licenses:
|
122
|
+
- MIT
|
123
|
+
metadata:
|
124
|
+
rubygems_mfa_required: 'true'
|
125
|
+
post_install_message:
|
126
|
+
rdoc_options: []
|
127
|
+
require_paths:
|
128
|
+
- lib
|
129
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
130
|
+
requirements:
|
131
|
+
- - ">="
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '2.7'
|
134
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 1.3.6
|
139
|
+
requirements: []
|
140
|
+
rubygems_version: 3.1.6
|
141
|
+
signing_key:
|
142
|
+
specification_version: 4
|
143
|
+
summary: Fast ruby link checker.
|
144
|
+
test_files: []
|