site-inspector 3.1.1 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +1 -1
  3. data/.rubocop.yml +18 -10
  4. data/.rubocop_todo.yml +139 -0
  5. data/.ruby-version +1 -1
  6. data/Gemfile +4 -0
  7. data/Guardfile +2 -0
  8. data/Rakefile +2 -0
  9. data/bin/site-inspector +7 -6
  10. data/lib/cliver/dependency_ext.rb +6 -3
  11. data/lib/site-inspector.rb +18 -11
  12. data/lib/site-inspector/cache.rb +2 -0
  13. data/lib/site-inspector/checks/accessibility.rb +30 -22
  14. data/lib/site-inspector/checks/check.rb +4 -2
  15. data/lib/site-inspector/checks/content.rb +15 -4
  16. data/lib/site-inspector/checks/cookies.rb +5 -3
  17. data/lib/site-inspector/checks/dns.rb +13 -11
  18. data/lib/site-inspector/checks/headers.rb +8 -6
  19. data/lib/site-inspector/checks/hsts.rb +16 -12
  20. data/lib/site-inspector/checks/https.rb +3 -1
  21. data/lib/site-inspector/checks/sniffer.rb +10 -7
  22. data/lib/site-inspector/checks/wappalyzer.rb +62 -0
  23. data/lib/site-inspector/checks/whois.rb +36 -0
  24. data/lib/site-inspector/disk_cache.rb +2 -0
  25. data/lib/site-inspector/domain.rb +36 -30
  26. data/lib/site-inspector/endpoint.rb +22 -23
  27. data/lib/site-inspector/rails_cache.rb +2 -0
  28. data/lib/site-inspector/version.rb +3 -1
  29. data/package-lock.json +505 -0
  30. data/package.json +1 -1
  31. data/script/pa11y-version +1 -0
  32. data/site-inspector.gemspec +24 -17
  33. data/spec/checks/site_inspector_endpoint_accessibility_spec.rb +15 -13
  34. data/spec/checks/site_inspector_endpoint_check_spec.rb +9 -7
  35. data/spec/checks/site_inspector_endpoint_content_spec.rb +30 -21
  36. data/spec/checks/site_inspector_endpoint_cookies_spec.rb +17 -15
  37. data/spec/checks/site_inspector_endpoint_dns_spec.rb +42 -40
  38. data/spec/checks/site_inspector_endpoint_headers_spec.rb +12 -10
  39. data/spec/checks/site_inspector_endpoint_hsts_spec.rb +27 -25
  40. data/spec/checks/site_inspector_endpoint_https_spec.rb +12 -10
  41. data/spec/checks/site_inspector_endpoint_sniffer_spec.rb +33 -31
  42. data/spec/checks/site_inspector_endpoint_wappalyzer_spec.rb +34 -0
  43. data/spec/checks/site_inspector_endpoint_whois_spec.rb +26 -0
  44. data/spec/fixtures/wappalyzer.json +125 -0
  45. data/spec/site_inspector_cache_spec.rb +2 -0
  46. data/spec/site_inspector_disk_cache_spec.rb +8 -6
  47. data/spec/site_inspector_domain_spec.rb +34 -34
  48. data/spec/site_inspector_endpoint_spec.rb +44 -43
  49. data/spec/site_inspector_spec.rb +15 -13
  50. data/spec/spec_helper.rb +2 -0
  51. metadata +125 -55
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe SiteInspector::Cache do
@@ -1,26 +1,28 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe SiteInspector::DiskCache do
4
- subject { SiteInspector::DiskCache.new(tmpdir) }
6
+ subject { described_class.new(tmpdir) }
5
7
 
6
8
  before do
7
9
  FileUtils.rm_rf(tmpdir)
8
10
  Dir.mkdir(tmpdir)
9
11
  end
10
12
 
11
- it 'should write a value to disk' do
13
+ it 'writes a value to disk' do
12
14
  foo = Typhoeus::Request.new('foo')
13
15
 
14
16
  path = File.expand_path foo.cache_key, tmpdir
15
- expect(File.exist?(path)).to eql(false)
17
+ expect(File.exist?(path)).to be(false)
16
18
 
17
19
  subject.set foo, 'bar'
18
20
 
19
- expect(File.exist?(path)).to eql(true)
21
+ expect(File.exist?(path)).to be(true)
20
22
  expect(File.open(path).read).to eql("I\"bar:ET")
21
23
  end
22
24
 
23
- it 'should read a value from disk' do
25
+ it 'reads a value from disk' do
24
26
  foo = Typhoeus::Request.new('foo')
25
27
 
26
28
  path = File.expand_path foo.cache_key, tmpdir
@@ -28,7 +30,7 @@ describe SiteInspector::DiskCache do
28
30
  expect(subject.get(foo)).to eql('bar')
29
31
  end
30
32
 
31
- it "should calculate a file's path" do
33
+ it "calculates a file's path" do
32
34
  foo = Typhoeus::Request.new('foo')
33
35
 
34
36
  path = File.expand_path foo.cache_key, tmpdir
@@ -1,41 +1,43 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe SiteInspector::Domain do
4
- subject { SiteInspector::Domain.new('example.com') }
6
+ subject { described_class.new('example.com') }
5
7
 
6
8
  context 'domain parsing' do
7
9
  it 'downcases the domain' do
8
- domain = SiteInspector::Domain.new('EXAMPLE.com')
10
+ domain = described_class.new('EXAMPLE.com')
9
11
  expect(domain.host).to eql('example.com')
10
12
  end
11
13
 
12
14
  it 'strips http from the domain' do
13
- domain = SiteInspector::Domain.new('http://example.com')
15
+ domain = described_class.new('http://example.com')
14
16
  expect(domain.host).to eql('example.com')
15
17
  end
16
18
 
17
19
  it 'strips https from the domain' do
18
- domain = SiteInspector::Domain.new('https://example.com')
20
+ domain = described_class.new('https://example.com')
19
21
  expect(domain.host).to eql('example.com')
20
22
  end
21
23
 
22
24
  it 'strips www from the domain' do
23
- domain = SiteInspector::Domain.new('www.example.com')
25
+ domain = described_class.new('www.example.com')
24
26
  expect(domain.host).to eql('example.com')
25
27
  end
26
28
 
27
29
  it 'strips http://www from the domain' do
28
- domain = SiteInspector::Domain.new('http://www.example.com')
30
+ domain = described_class.new('http://www.example.com')
29
31
  expect(domain.host).to eql('example.com')
30
32
  end
31
33
 
32
34
  it 'strips paths from the domain' do
33
- domain = SiteInspector::Domain.new('http://www.example.com/foo')
35
+ domain = described_class.new('http://www.example.com/foo')
34
36
  expect(domain.host).to eql('example.com')
35
37
  end
36
38
 
37
39
  it 'strips trailing slashes from the domain' do
38
- domain = SiteInspector::Domain.new('http://www.example.com/')
40
+ domain = described_class.new('http://www.example.com/')
39
41
  expect(domain.host).to eql('example.com')
40
42
  end
41
43
  end
@@ -43,7 +45,7 @@ describe SiteInspector::Domain do
43
45
  context 'endpoints' do
44
46
  it 'generates the endpoints' do
45
47
  endpoints = subject.endpoints
46
- expect(endpoints.count).to eql(4)
48
+ expect(endpoints.count).to be(4)
47
49
  expect(endpoints[0].to_s).to eql('https://example.com/')
48
50
  expect(endpoints[1].to_s).to eql('https://www.example.com/')
49
51
  expect(endpoints[2].to_s).to eql('http://example.com/')
@@ -60,23 +62,21 @@ describe SiteInspector::Domain do
60
62
  end
61
63
 
62
64
  it 'knows if a domain is a government domain' do
63
- expect(subject.government?).to eql(false)
65
+ expect(subject.government?).to be(false)
64
66
 
65
- domain = SiteInspector::Domain.new('whitehouse.gov')
66
- expect(domain.government?).to eql(true)
67
+ domain = described_class.new('whitehouse.gov')
68
+ expect(domain.government?).to be(true)
67
69
  end
68
70
 
69
71
  context 'up' do
70
72
  it 'considers a domain up if at least one endpoint is up' do
71
73
  subject.endpoints.each do |endpoint|
72
- unless endpoint.uri.to_s.start_with?('http://www')
73
- allow(endpoint).to receive(:response) { Typhoeus::Response.new(code: 0) }
74
- end
74
+ allow(endpoint).to receive(:response) { Typhoeus::Response.new(code: 0) } unless endpoint.uri.to_s.start_with?('http://www')
75
75
  end
76
76
 
77
77
  stub_request(:head, 'http://www.example.com/').to_return(status: 200)
78
78
 
79
- expect(subject.up?).to eql(true)
79
+ expect(subject.up?).to be(true)
80
80
  end
81
81
 
82
82
  it "doesn't consider a domain up when all endpoints are down" do
@@ -84,7 +84,7 @@ describe SiteInspector::Domain do
84
84
  allow(endpoint).to receive(:response) { Typhoeus::Response.new(code: 0) }
85
85
  end
86
86
 
87
- expect(subject.up?).to eql(false)
87
+ expect(subject.up?).to be(false)
88
88
  end
89
89
  end
90
90
 
@@ -95,7 +95,7 @@ describe SiteInspector::Domain do
95
95
  stub_request(:head, 'http://example.com/').to_return(status: 500)
96
96
  stub_request(:head, 'http://www.example.com/').to_return(status: 200)
97
97
 
98
- expect(subject.up?).to eql(true)
98
+ expect(subject.up?).to be(true)
99
99
  end
100
100
 
101
101
  it "doesn't consider a domain up if all endpoints are down" do
@@ -104,7 +104,7 @@ describe SiteInspector::Domain do
104
104
  stub_request(:head, 'http://example.com/').to_return(status: 500)
105
105
  stub_request(:head, 'http://www.example.com/').to_return(status: 500)
106
106
 
107
- expect(subject.up?).to eql(false)
107
+ expect(subject.up?).to be(false)
108
108
  end
109
109
  end
110
110
 
@@ -115,7 +115,7 @@ describe SiteInspector::Domain do
115
115
  stub_request(:head, 'http://example.com/').to_return(status: 500)
116
116
  stub_request(:head, 'http://www.example.com/').to_return(status: 200)
117
117
 
118
- expect(subject.www?).to eql(true)
118
+ expect(subject.www?).to be(true)
119
119
  end
120
120
 
121
121
  it "doesn't consider a site www when no endpoint is www" do
@@ -124,7 +124,7 @@ describe SiteInspector::Domain do
124
124
  stub_request(:head, 'http://example.com/').to_return(status: 200)
125
125
  stub_request(:head, 'http://www.example.com/').to_return(status: 500)
126
126
 
127
- expect(subject.www?).to eql(false)
127
+ expect(subject.www?).to be(false)
128
128
  end
129
129
  end
130
130
 
@@ -135,7 +135,7 @@ describe SiteInspector::Domain do
135
135
  stub_request(:head, 'http://example.com/').to_return(status: 500)
136
136
  stub_request(:head, 'http://www.example.com/').to_return(status: 500)
137
137
 
138
- expect(subject.root?).to eql(true)
138
+ expect(subject.root?).to be(true)
139
139
  end
140
140
 
141
141
  it "doesn't call a www-only domain root" do
@@ -144,7 +144,7 @@ describe SiteInspector::Domain do
144
144
  stub_request(:head, 'http://example.com/').to_return(status: 500)
145
145
  stub_request(:head, 'http://www.example.com/').to_return(status: 200)
146
146
 
147
- expect(subject.root?).to eql(false)
147
+ expect(subject.root?).to be(false)
148
148
  end
149
149
  end
150
150
 
@@ -154,9 +154,9 @@ describe SiteInspector::Domain do
154
154
  stub_request(:head, 'https://www.example.com/').to_return(status: 200)
155
155
  stub_request(:head, 'http://example.com/').to_return(status: 200)
156
156
  stub_request(:head, 'http://www.example.com/').to_return(status: 200)
157
- allow(subject.endpoints.first.https).to receive(:valid?) { true }
157
+ allow(subject.endpoints.first.https).to receive(:valid?).and_return(true)
158
158
 
159
- expect(subject.https?).to eql(true)
159
+ expect(subject.https?).to be(true)
160
160
  end
161
161
 
162
162
  it "knows when a domain doesn't support https" do
@@ -165,7 +165,7 @@ describe SiteInspector::Domain do
165
165
  stub_request(:head, 'http://example.com/').to_return(status: 200)
166
166
  stub_request(:head, 'http://www.example.com/').to_return(status: 200)
167
167
 
168
- expect(subject.https?).to eql(false)
168
+ expect(subject.https?).to be(false)
169
169
  end
170
170
 
171
171
  it 'considers HTTPS inforced when no http endpoint responds' do
@@ -183,7 +183,7 @@ describe SiteInspector::Domain do
183
183
  stub_request(:head, 'http://example.com/').to_return(status: 500)
184
184
  stub_request(:head, 'http://www.example.com/').to_return(status: 200)
185
185
 
186
- expect(subject.enforces_https?).to eql(false)
186
+ expect(subject.enforces_https?).to be(false)
187
187
  end
188
188
 
189
189
  it 'detects when a domain downgrades to http' do
@@ -203,7 +203,7 @@ describe SiteInspector::Domain do
203
203
  stub_request(:head, 'http://example.com/').to_return(status: 500)
204
204
  stub_request(:head, 'http://www.example.com/').to_return(status: 200)
205
205
 
206
- expect(subject.canonically_www?).to eql(true)
206
+ expect(subject.canonically_www?).to be(true)
207
207
  end
208
208
 
209
209
  it 'detects a domain as canonically www when root redirects' do
@@ -213,7 +213,7 @@ describe SiteInspector::Domain do
213
213
  .to_return(status: 301, headers: { location: 'http://www.example.com' })
214
214
  stub_request(:head, 'http://www.example.com/').to_return(status: 200)
215
215
 
216
- expect(subject.canonically_www?).to eql(true)
216
+ expect(subject.canonically_www?).to be(true)
217
217
  end
218
218
  end
219
219
 
@@ -223,9 +223,9 @@ describe SiteInspector::Domain do
223
223
  stub_request(:head, 'https://www.example.com/').to_return(status: 200)
224
224
  stub_request(:head, 'http://example.com/').to_return(status: 500)
225
225
  stub_request(:head, 'http://www.example.com/').to_return(status: 500)
226
- allow(subject.endpoints.first.https).to receive(:valid?) { true }
226
+ allow(subject.endpoints.first.https).to receive(:valid?).and_return(true)
227
227
 
228
- expect(subject.canonically_https?).to eql(true)
228
+ expect(subject.canonically_https?).to be(true)
229
229
  end
230
230
 
231
231
  it 'detects a domain as canonically https when http redirect' do
@@ -234,9 +234,9 @@ describe SiteInspector::Domain do
234
234
  stub_request(:head, 'http://example.com/')
235
235
  .to_return(status: 301, headers: { location: 'https://example.com' })
236
236
  stub_request(:head, 'http://www.example.com/').to_return(status: 500)
237
- allow(subject.endpoints.first.https).to receive(:valid?) { true }
237
+ allow(subject.endpoints.first.https).to receive(:valid?).and_return(true)
238
238
 
239
- expect(subject.canonically_https?).to eql(true)
239
+ expect(subject.canonically_https?).to be(true)
240
240
  end
241
241
  end
242
242
  end
@@ -250,7 +250,7 @@ describe SiteInspector::Domain do
250
250
  stub_request(:head, 'http://www.example.com/').to_return(status: 500)
251
251
  stub_request(:head, 'http://foo.example.com/').to_return(status: 200)
252
252
 
253
- expect(subject.redirect?).to eql(true)
253
+ expect(subject.redirect?).to be(true)
254
254
  end
255
255
  end
256
256
 
@@ -1,16 +1,17 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe SiteInspector::Endpoint do
4
-
5
- subject { SiteInspector::Endpoint.new('http://example.com') }
6
+ subject { described_class.new('http://example.com') }
6
7
 
7
8
  it 'downcases the host' do
8
- endpoint = SiteInspector::Endpoint.new('http://EXAMPLE.com')
9
+ endpoint = described_class.new('http://EXAMPLE.com')
9
10
  expect(endpoint.host).to eql('example.com')
10
11
  end
11
12
 
12
13
  it 'strips www from the host' do
13
- endpoint = SiteInspector::Endpoint.new('http://www.example.com')
14
+ endpoint = described_class.new('http://www.example.com')
14
15
  expect(endpoint.host).to eql('example.com')
15
16
  end
16
17
 
@@ -19,12 +20,12 @@ describe SiteInspector::Endpoint do
19
20
  end
20
21
 
21
22
  it 'knows if an endpoint is www' do
22
- expect(subject.www?).to eql(false)
23
- expect(subject.root?).to eql(true)
23
+ expect(subject.www?).to be(false)
24
+ expect(subject.root?).to be(true)
24
25
 
25
- endpoint = SiteInspector::Endpoint.new('http://www.example.com')
26
- expect(endpoint.www?).to eql(true)
27
- expect(endpoint.root?).to eql(false)
26
+ endpoint = described_class.new('http://www.example.com')
27
+ expect(endpoint.www?).to be(true)
28
+ expect(endpoint.root?).to be(false)
28
29
  end
29
30
 
30
31
  it 'knows if an endpoint is http' do
@@ -34,8 +35,8 @@ describe SiteInspector::Endpoint do
34
35
  stub_request(:head, 'https://example.com/')
35
36
  .to_return(status: 500, body: 'content')
36
37
 
37
- expect(subject.https?).to eql(false)
38
- expect(subject.http?).to eql(true)
38
+ expect(subject.https?).to be(false)
39
+ expect(subject.http?).to be(true)
39
40
  end
40
41
 
41
42
  it 'knows if an endpoint is https' do
@@ -45,15 +46,15 @@ describe SiteInspector::Endpoint do
45
46
  stub_request(:head, 'https://example.com/')
46
47
  .to_return(status: 200, body: 'content')
47
48
 
48
- endpoint = SiteInspector::Endpoint.new('https://example.com')
49
- expect(endpoint.https?).to eql(true)
50
- expect(endpoint.http?).to eql(false)
49
+ endpoint = described_class.new('https://example.com')
50
+ expect(endpoint.https?).to be(true)
51
+ expect(endpoint.http?).to be(false)
51
52
  end
52
53
 
53
54
  it 'knows the scheme' do
54
55
  expect(subject.scheme).to eql('http')
55
56
 
56
- endpoint = SiteInspector::Endpoint.new('https://example.com')
57
+ endpoint = described_class.new('https://example.com')
57
58
  expect(endpoint.scheme).to eql('https')
58
59
  end
59
60
 
@@ -79,7 +80,7 @@ describe SiteInspector::Endpoint do
79
80
  .to_return(status: 301, headers: { location: 'http://example.com/foo' })
80
81
 
81
82
  response = subject.request(followlocation: true)
82
- expect(response.request.options[:followlocation]).to eql(true)
83
+ expect(response.request.options[:followlocation]).to be(true)
83
84
  end
84
85
 
85
86
  it 'returns the response' do
@@ -95,15 +96,15 @@ describe SiteInspector::Endpoint do
95
96
  stub_request(:head, 'http://example.com/')
96
97
  .to_return(status: 200, body: 'content')
97
98
 
98
- expect(subject.responds?).to eql(true)
99
+ expect(subject.responds?).to be(true)
99
100
  end
100
101
 
101
102
  it "knows when there's not a response" do
102
103
  allow(subject).to receive(:response) { Typhoeus::Response.new(code: 0) }
103
- expect(subject.responds?).to eql(false)
104
+ expect(subject.responds?).to be(false)
104
105
 
105
106
  allow(subject).to receive(:response) { Typhoeus::Response.new(return_code: :operation_timedout) }
106
- expect(subject.responds?).to eql(false)
107
+ expect(subject.responds?).to be(false)
107
108
  end
108
109
 
109
110
  it 'knows the response code' do
@@ -115,53 +116,53 @@ describe SiteInspector::Endpoint do
115
116
 
116
117
  it 'knows if a response has timed out' do
117
118
  allow(subject).to receive(:response) { Typhoeus::Response.new(return_code: :operation_timedout) }
118
- expect(subject.timed_out?).to eql(true)
119
+ expect(subject.timed_out?).to be(true)
119
120
  end
120
121
 
121
122
  it 'considers a 200 response code to be live and a response' do
122
123
  stub_request(:head, 'http://example.com/')
123
124
  .to_return(status: 200)
124
125
 
125
- expect(subject.up?).to eql(true)
126
- expect(subject.responds?).to eql(true)
126
+ expect(subject.up?).to be(true)
127
+ expect(subject.responds?).to be(true)
127
128
  end
128
129
 
129
130
  it 'considers a 301 response code to be live and a response' do
130
131
  stub_request(:head, 'http://example.com/')
131
132
  .to_return(status: 301)
132
133
 
133
- expect(subject.up?).to eql(true)
134
- expect(subject.responds?).to eql(true)
134
+ expect(subject.up?).to be(true)
135
+ expect(subject.responds?).to be(true)
135
136
  end
136
137
 
137
138
  it 'considers a 404 response code to be down but a response' do
138
139
  stub_request(:head, 'http://example.com/')
139
140
  .to_return(status: 404)
140
141
 
141
- expect(subject.up?).to eql(false)
142
- expect(subject.responds?).to eql(true)
142
+ expect(subject.up?).to be(false)
143
+ expect(subject.responds?).to be(true)
143
144
  end
144
145
 
145
146
  it 'considers a 500 response code to be down but a response' do
146
147
  stub_request(:head, 'http://example.com/')
147
148
  .to_return(status: 500)
148
149
 
149
- expect(subject.up?).to eql(false)
150
- expect(subject.responds?).to eql(true)
150
+ expect(subject.up?).to be(false)
151
+ expect(subject.responds?).to be(true)
151
152
  end
152
153
 
153
154
  it 'considers a 0 response code (error) to down and unresponsive' do
154
155
  allow(subject).to receive(:response) { Typhoeus::Response.new(code: 0) }
155
156
 
156
- expect(subject.up?).to eql(false)
157
- expect(subject.responds?).to eql(false)
157
+ expect(subject.up?).to be(false)
158
+ expect(subject.responds?).to be(false)
158
159
  end
159
160
 
160
161
  it 'considers a timeout to be down and unresponsive' do
161
162
  allow(subject).to receive(:response) { Typhoeus::Response.new(return_code: :operation_timedout) }
162
163
 
163
- expect(subject.up?).to eql(false)
164
- expect(subject.responds?).to eql(false)
164
+ expect(subject.up?).to be(false)
165
+ expect(subject.responds?).to be(false)
165
166
  end
166
167
  end
167
168
 
@@ -170,7 +171,7 @@ describe SiteInspector::Endpoint do
170
171
  stub_request(:head, 'http://example.com/')
171
172
  .to_return(status: 301, headers: { location: 'http://www.example.com' })
172
173
 
173
- expect(subject.redirect?).to eql(true)
174
+ expect(subject.redirect?).to be(true)
174
175
  end
175
176
 
176
177
  it 'returns the redirect' do
@@ -187,14 +188,14 @@ describe SiteInspector::Endpoint do
187
188
  stub_request(:head, 'http://example.com/')
188
189
  .to_return(status: 301, headers: { location: '/foo' })
189
190
 
190
- expect(subject.redirect?).to eql(false)
191
+ expect(subject.redirect?).to be(false)
191
192
  end
192
193
 
193
194
  it 'handles relative redirects without a leading slash' do
194
195
  stub_request(:head, 'http://example.com/')
195
196
  .to_return(status: 301, headers: { location: 'foo' })
196
197
 
197
- expect(subject.redirect?).to eql(false)
198
+ expect(subject.redirect?).to be(false)
198
199
  end
199
200
 
200
201
  it 'knows what it resolves to' do
@@ -204,7 +205,7 @@ describe SiteInspector::Endpoint do
204
205
  stub_request(:head, 'http://www.example.com/')
205
206
  .to_return(status: 200)
206
207
 
207
- expect(subject.redirect?).to eql(true)
208
+ expect(subject.redirect?).to be(true)
208
209
  expect(subject.resolves_to.uri.to_s).to eql('http://www.example.com/')
209
210
  end
210
211
 
@@ -215,8 +216,8 @@ describe SiteInspector::Endpoint do
215
216
  stub_request(:head, 'http://www.example.gov')
216
217
  .to_return(status: 200)
217
218
 
218
- expect(subject.redirect?).to eql(true)
219
- expect(subject.external_redirect?).to eql(true)
219
+ expect(subject.redirect?).to be(true)
220
+ expect(subject.external_redirect?).to be(true)
220
221
  end
221
222
 
222
223
  it 'knows internal redirects are not external redirects' do
@@ -226,24 +227,24 @@ describe SiteInspector::Endpoint do
226
227
  stub_request(:head, 'https://example.com/')
227
228
  .to_return(status: 200)
228
229
 
229
- expect(subject.external_redirect?).to eql(false)
230
+ expect(subject.external_redirect?).to be(false)
230
231
  end
231
232
  end
232
233
 
233
234
  context 'checks' do
234
235
  it 'identifies checks' do
235
- expected = 8
236
+ expected = 9
236
237
  pa11y = SiteInspector::Endpoint::Accessibility.pa11y?
237
238
  expected -= 1 unless pa11y
238
- expect(SiteInspector::Endpoint.checks.count).to eql(expected)
239
+ expect(described_class.checks.count).to eql(expected)
239
240
  end
240
241
 
241
- SiteInspector::Endpoint.checks.each do |check|
242
+ described_class.checks.each do |check|
242
243
  it "responds to the #{check} check" do
243
244
  stub_request(:head, 'http://example.com/')
244
245
  .to_return(status: 200)
245
246
 
246
- expect(subject.send(check.name)).to_not be_nil
247
+ expect(subject.send(check.name)).not_to be_nil
247
248
  expect(subject.send(check.name).class).to eql(check)
248
249
  end
249
250
  end