bad_link_finder 0.3.0 → 0.3.1

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: 1958650ee80f6111928153181b576b6e2964450b
4
- data.tar.gz: 74cf1cdd49ee638a65d5759dd051ad32709a5693
3
+ metadata.gz: 8043b2bdbf6388c865a5df0b2df8c3c11d4bfd19
4
+ data.tar.gz: bf52e9188c38476b68cf198e92534ea77a2da19b
5
5
  SHA512:
6
- metadata.gz: 0dbf259bf6364c615f222ec5698bf3816212373ce12dc056a5edd9ac51ec2a4daedfbd37759d7a655f7320a041f0772a80f193f1fda9e4751cedaf58a659e06a
7
- data.tar.gz: f3049d9b48675bdbf2eddfc35cda601fdb67b75321bb96ee78299a2cbccdeb840f865b97ee8488e82cb610c1df94c70ebaa5fa2adfd14eb5d1715a655ab4748c
6
+ metadata.gz: 67b3140911740a7775053a45f879a065b331422edf99c4820990844967da2efaededcca5873fd8521cdd4b8a8e18df6b007a10e49608652a85179fd7ac914b20
7
+ data.tar.gz: a9c53982fb8e726f1df1a248043d58edf122fece52f16e35db8392a8a1b4e13ecee9d4d9e8ea9a819272456115323636bab4f0bb49a405c22529a986dba41a95
@@ -15,7 +15,7 @@ module BadLinkFinder
15
15
  rescue URI::InvalidURIError => exception
16
16
  record_error("This link is in a bad format", exception)
17
17
  rescue Mechanize::ResponseCodeError => exception
18
- if exception.response_code.to_i == 405 && !@head_unsupported
18
+ if [405, 500].include?(exception.response_code.to_i) && !@head_unsupported
19
19
  @head_unsupported = true
20
20
  retry
21
21
  else
@@ -1,3 +1,3 @@
1
1
  module BadLinkFinder
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
@@ -63,6 +63,14 @@ describe BadLinkFinder::Link do
63
63
 
64
64
  assert link.valid?
65
65
  end
66
+
67
+ it "retries 500s as GET requests" do
68
+ stub_request(:head, "http://www.example.com/an-example-path").to_return(status: 500)
69
+ stub_request(:get, "http://www.example.com/an-example-path").to_return(status: 200)
70
+ link = build_link('/an-example-path')
71
+
72
+ assert link.valid?
73
+ end
66
74
  end
67
75
 
68
76
  def stub_url(url, status)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bad_link_finder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elliot Crosby-McCullough
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-26 00:00:00.000000000 Z
11
+ date: 2014-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mechanize
@@ -117,30 +117,30 @@ executables:
117
117
  extensions: []
118
118
  extra_rdoc_files: []
119
119
  files:
120
- - LICENCE.txt
121
- - README.md
122
120
  - bin/bad_link_finder
123
121
  - lib/bad_link_finder.rb
122
+ - lib/bad_link_finder/site.rb
123
+ - lib/bad_link_finder/result_cache.rb
124
124
  - lib/bad_link_finder/csv_builder.rb
125
- - lib/bad_link_finder/link.rb
125
+ - lib/bad_link_finder/site_checker.rb
126
126
  - lib/bad_link_finder/page.rb
127
127
  - lib/bad_link_finder/page_checker.rb
128
- - lib/bad_link_finder/result_cache.rb
129
- - lib/bad_link_finder/site.rb
130
- - lib/bad_link_finder/site_checker.rb
131
128
  - lib/bad_link_finder/version.rb
132
- - test/fixtures/www.example.com/example/index.html
133
- - test/fixtures/www.example.com/example/relative-example.html
134
- - test/fixtures/www.example.com/index.html
129
+ - lib/bad_link_finder/link.rb
130
+ - README.md
131
+ - LICENCE.txt
135
132
  - test/integration/bad_link_finder_test.rb
136
- - test/support/matchers.rb
137
- - test/test_helper.rb
133
+ - test/unit/page_test.rb
134
+ - test/unit/site_test.rb
138
135
  - test/unit/csv_builder_test.rb
136
+ - test/unit/result_cache_test.rb
139
137
  - test/unit/link_test.rb
140
138
  - test/unit/page_checker_test.rb
141
- - test/unit/page_test.rb
142
- - test/unit/result_cache_test.rb
143
- - test/unit/site_test.rb
139
+ - test/support/matchers.rb
140
+ - test/fixtures/www.example.com/example/index.html
141
+ - test/fixtures/www.example.com/example/relative-example.html
142
+ - test/fixtures/www.example.com/index.html
143
+ - test/test_helper.rb
144
144
  homepage: http://github.com/alphagov/bad_link_finder
145
145
  licenses:
146
146
  - MIT
@@ -161,20 +161,20 @@ required_rubygems_version: !ruby/object:Gem::Requirement
161
161
  version: '0'
162
162
  requirements: []
163
163
  rubyforge_project:
164
- rubygems_version: 2.2.0
164
+ rubygems_version: 2.1.11
165
165
  signing_key:
166
166
  specification_version: 4
167
167
  summary: Tests links in static site mirrors
168
168
  test_files:
169
- - test/fixtures/www.example.com/example/index.html
170
- - test/fixtures/www.example.com/example/relative-example.html
171
- - test/fixtures/www.example.com/index.html
172
169
  - test/integration/bad_link_finder_test.rb
173
- - test/support/matchers.rb
174
- - test/test_helper.rb
170
+ - test/unit/page_test.rb
171
+ - test/unit/site_test.rb
175
172
  - test/unit/csv_builder_test.rb
173
+ - test/unit/result_cache_test.rb
176
174
  - test/unit/link_test.rb
177
175
  - test/unit/page_checker_test.rb
178
- - test/unit/page_test.rb
179
- - test/unit/result_cache_test.rb
180
- - test/unit/site_test.rb
176
+ - test/support/matchers.rb
177
+ - test/fixtures/www.example.com/example/index.html
178
+ - test/fixtures/www.example.com/example/relative-example.html
179
+ - test/fixtures/www.example.com/index.html
180
+ - test/test_helper.rb