site-inspector 3.1.0 → 3.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +34 -0
  3. data/.ruby-version +1 -1
  4. data/Gemfile +1 -1
  5. data/Guardfile +1 -1
  6. data/README.md +6 -1
  7. data/Rakefile +2 -2
  8. data/bin/site-inspector +15 -15
  9. data/lib/cliver/dependency_ext.rb +21 -0
  10. data/lib/site-inspector.rb +13 -11
  11. data/lib/site-inspector/checks/accessibility.rb +27 -17
  12. data/lib/site-inspector/checks/check.rb +1 -3
  13. data/lib/site-inspector/checks/content.rb +6 -6
  14. data/lib/site-inspector/checks/cookies.rb +6 -8
  15. data/lib/site-inspector/checks/dns.rb +21 -20
  16. data/lib/site-inspector/checks/headers.rb +12 -13
  17. data/lib/site-inspector/checks/hsts.rb +8 -9
  18. data/lib/site-inspector/checks/https.rb +3 -5
  19. data/lib/site-inspector/checks/sniffer.rb +8 -9
  20. data/lib/site-inspector/domain.rb +28 -32
  21. data/lib/site-inspector/endpoint.rb +31 -32
  22. data/lib/site-inspector/version.rb +1 -1
  23. data/script/cibuild +3 -1
  24. data/script/pa11y-version +9 -0
  25. data/site-inspector.gemspec +25 -25
  26. data/spec/checks/site_inspector_endpoint_accessibility_spec.rb +31 -30
  27. data/spec/checks/site_inspector_endpoint_check_spec.rb +10 -11
  28. data/spec/checks/site_inspector_endpoint_content_spec.rb +43 -44
  29. data/spec/checks/site_inspector_endpoint_cookies_spec.rb +30 -31
  30. data/spec/checks/site_inspector_endpoint_dns_spec.rb +72 -77
  31. data/spec/checks/site_inspector_endpoint_headers_spec.rb +26 -27
  32. data/spec/checks/site_inspector_endpoint_hsts_spec.rb +26 -27
  33. data/spec/checks/site_inspector_endpoint_https_spec.rb +11 -12
  34. data/spec/checks/site_inspector_endpoint_sniffer_spec.rb +56 -57
  35. data/spec/site_inspector_cache_spec.rb +6 -6
  36. data/spec/site_inspector_disk_cache_spec.rb +9 -9
  37. data/spec/site_inspector_domain_spec.rb +132 -136
  38. data/spec/site_inspector_endpoint_spec.rb +108 -108
  39. data/spec/site_inspector_spec.rb +17 -18
  40. data/spec/spec_helper.rb +3 -3
  41. metadata +21 -3
@@ -1,3 +1,3 @@
1
1
  class SiteInspector
2
- VERSION = "3.1.0"
2
+ VERSION = '3.1.1'
3
3
  end
@@ -2,8 +2,10 @@
2
2
 
3
3
  set -e
4
4
 
5
- echo "Pa11y version: $(pa11y --version)"
5
+ script/pa11y-version
6
6
 
7
7
  bundle exec rake spec
8
8
 
9
+ bundle exec rubocop
10
+
9
11
  gem build site-inspector.gemspec
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require './lib/site-inspector'
4
+
5
+ if SiteInspector::Endpoint::Accessibility.pa11y?
6
+ puts "Pa11y version: #{SiteInspector::Endpoint::Accessibility.pa11y_version}"
7
+ else
8
+ puts '**RUNNING TESTS WITHOUT PA11Y**'
9
+ end
@@ -1,35 +1,35 @@
1
- require File.expand_path "./lib/site-inspector/version", File.dirname(__FILE__)
1
+ require File.expand_path './lib/site-inspector/version', File.dirname(__FILE__)
2
2
 
3
3
  Gem::Specification.new do |s|
4
-
5
- s.name = "site-inspector"
4
+ s.name = 'site-inspector'
6
5
  s.version = SiteInspector::VERSION
7
- s.summary = "A Ruby port and v2 of Site Inspector (https://github.com/benbalter/site-inspector)"
6
+ s.summary = 'A Ruby port and v2 of Site Inspector (https://github.com/benbalter/site-inspector)'
8
7
  s.description = "Returns information about a domain's technology and capabilities"
9
- s.authors = "Ben Balter"
10
- s.email = "ben@balter.com"
11
- s.homepage = "https://github.com/benbalter/site-inspector"
12
- s.license = "MIT"
8
+ s.authors = 'Ben Balter'
9
+ s.email = 'ben@balter.com'
10
+ s.homepage = 'https://github.com/benbalter/site-inspector'
11
+ s.license = 'MIT'
13
12
 
14
13
  s.files = `git ls-files -z`.split("\x0")
15
14
  s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
16
15
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
17
- s.require_paths = ["lib"]
16
+ s.require_paths = ['lib']
18
17
 
19
- s.add_dependency("nokogiri", "~> 1.6")
20
- s.add_dependency("public_suffix", "~> 1.4")
21
- s.add_dependency("gman", "~> 4.1")
22
- s.add_dependency("dnsruby", "~> 1.56")
23
- s.add_dependency("sniffles", "~> 0.2")
24
- s.add_dependency("typhoeus", "~> 0.7")
25
- s.add_dependency("oj", "~> 2.11")
26
- s.add_dependency("mercenary", "~> 0.3")
27
- s.add_dependency("colorator", "~> 0.1")
28
- s.add_dependency("cliver", "~> 0.3")
29
- s.add_dependency("parallel", "~> 1.6")
30
- s.add_development_dependency("pry", "~> 0.10")
31
- s.add_development_dependency( "rake", "~> 10.4" )
32
- s.add_development_dependency( "rspec", "~> 3.2")
33
- s.add_development_dependency( "bundler", "~> 1.6" )
34
- s.add_development_dependency( "webmock", "~> 1.2" )
18
+ s.add_dependency('nokogiri', '~> 1.6')
19
+ s.add_dependency('public_suffix', '~> 1.4')
20
+ s.add_dependency('gman', '~> 4.1')
21
+ s.add_dependency('dnsruby', '~> 1.56')
22
+ s.add_dependency('sniffles', '~> 0.2')
23
+ s.add_dependency('typhoeus', '~> 0.7')
24
+ s.add_dependency('oj', '~> 2.11')
25
+ s.add_dependency('mercenary', '~> 0.3')
26
+ s.add_dependency('colorator', '~> 0.1')
27
+ s.add_dependency('cliver', '~> 0.3')
28
+ s.add_dependency('parallel', '~> 1.6')
29
+ s.add_development_dependency('pry', '~> 0.10')
30
+ s.add_development_dependency('rake', '~> 10.4')
31
+ s.add_development_dependency('rspec', '~> 3.2')
32
+ s.add_development_dependency('bundler', '~> 1.6')
33
+ s.add_development_dependency('webmock', '~> 1.2')
34
+ s.add_development_dependency('rubocop', '~> 0.35')
35
35
  end
@@ -1,81 +1,82 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe SiteInspector::Endpoint::Accessibility do
4
-
5
4
  subject do
6
- endpoint = SiteInspector::Endpoint.new("http://example.com")
5
+ endpoint = SiteInspector::Endpoint.new('http://example.com')
7
6
  SiteInspector::Endpoint::Accessibility.new(endpoint)
8
7
  end
9
8
 
10
9
  it "retrieve's pa11y's version" do
10
+ pending('Pa11y not installed') unless SiteInspector::Endpoint::Accessibility.pa11y?
11
11
  expect(subject.class.pa11y_version).to match(/\d\.\d\.\d/)
12
12
  end
13
13
 
14
- it "responds to valid standards" do
14
+ it 'responds to valid standards' do
15
15
  expect(subject.respond_to?(:section508)).to eql(true)
16
16
  end
17
17
 
18
- it "knows the level" do
18
+ it 'knows the level' do
19
19
  expect(subject.level).to eql(:error)
20
20
  end
21
21
 
22
- it "allows the user to set the level" do
22
+ it 'allows the user to set the level' do
23
23
  subject.level = :warning
24
24
  expect(subject.level).to eql(:warning)
25
25
  end
26
26
 
27
- it "errors on invalid levels" do
28
- expect{subject.level="foo"}.to raise_error(ArgumentError)
27
+ it 'errors on invalid levels' do
28
+ expect { subject.level = 'foo' }.to raise_error(ArgumentError)
29
29
  end
30
30
 
31
- it "knows the standard" do
31
+ it 'knows the standard' do
32
32
  expect(subject.standard).to eql(:section508)
33
33
  end
34
34
 
35
- it "allows the user to set the standard" do
35
+ it 'allows the user to set the standard' do
36
36
  subject.standard = :wcag2a
37
37
  expect(subject.standard).to eql(:wcag2a)
38
38
  end
39
39
 
40
- it "errors on invalid standards" do
41
- expect{subject.standard=:foo}.to raise_error(ArgumentError)
40
+ it 'errors on invalid standards' do
41
+ expect { subject.standard = :foo }.to raise_error(ArgumentError)
42
42
  end
43
43
 
44
- context "with pa11y installed" do
45
-
44
+ context 'with pa11y installed' do
46
45
  before do
47
- stub_request(:head, "http://example.com/").to_return(:status => 200 )
46
+ stub_request(:head, 'http://example.com/').to_return(status: 200)
48
47
  end
49
-
50
48
  end
51
49
 
52
50
  context "with pa11y stub'd" do
53
-
54
51
  before do
55
52
  output = '[{"code":"Section508.L.NoContentAnchor","context":"<a href=\"foo\"></a>","message":"Anchor element found with a valid href attribute, but no link content has been supplied.","selector":"html > body > a","type":"error","typeCode":1}]'
56
53
  allow(subject).to receive(:run_command) { [output, 2] }
57
54
  end
58
55
 
59
- it "knows if pa11y is installed" do
60
- expect(subject.class.pa11y?).to eql(true)
61
- end
62
-
63
- it "knows if a site is valid" do
64
- expect(subject.valid?).to eql(false)
56
+ it 'knows if a site is valid' do
57
+ with_env 'SKIP_PA11Y_CHECK', 'true' do
58
+ expect(subject.valid?).to eql(false)
59
+ end
65
60
  end
66
61
 
67
- it "counts the errors" do
68
- expect(subject.errors).to eql(1)
62
+ it 'counts the errors' do
63
+ with_env 'SKIP_PA11Y_CHECK', 'true' do
64
+ expect(subject.errors).to eql(1)
65
+ end
69
66
  end
70
67
 
71
- it "runs the check" do
72
- expect(subject.check[:valid]).to eql(false)
73
- expect(subject.check[:results].first["code"]).to eql("Section508.L.NoContentAnchor")
68
+ it 'runs the check' do
69
+ with_env 'SKIP_PA11Y_CHECK', 'true' do
70
+ expect(subject.check[:valid]).to eql(false)
71
+ expect(subject.check[:results].first['code']).to eql('Section508.L.NoContentAnchor')
72
+ end
74
73
  end
75
74
 
76
- it "runs a named check" do
77
- expect(subject.check[:valid]).to eql(false)
78
- expect(subject.check[:results].first["code"]).to eql("Section508.L.NoContentAnchor")
75
+ it 'runs a named check' do
76
+ with_env 'SKIP_PA11Y_CHECK', 'true' do
77
+ expect(subject.check[:valid]).to eql(false)
78
+ expect(subject.check[:results].first['code']).to eql('Section508.L.NoContentAnchor')
79
+ end
79
80
  end
80
81
  end
81
82
  end
@@ -1,38 +1,37 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe SiteInspector::Endpoint::Check do
4
-
5
4
  subject do
6
- stub_request(:head, "http://example.com/").to_return(:status => 200)
7
- endpoint = SiteInspector::Endpoint.new("http://example.com")
5
+ stub_request(:head, 'http://example.com/').to_return(status: 200)
6
+ endpoint = SiteInspector::Endpoint.new('http://example.com')
8
7
  SiteInspector::Endpoint::Check.new(endpoint)
9
8
  end
10
9
 
11
- it "returns the endpoint" do
10
+ it 'returns the endpoint' do
12
11
  expect(subject.endpoint.class).to eql(SiteInspector::Endpoint)
13
12
  end
14
13
 
15
- it "returns the response" do
14
+ it 'returns the response' do
16
15
  expect(subject.response.class).to eql(Typhoeus::Response)
17
16
  end
18
17
 
19
- it "returns the request" do
18
+ it 'returns the request' do
20
19
  expect(subject.request.class).to eql(Typhoeus::Request)
21
20
  end
22
21
 
23
- it "returns the host" do
24
- expect(subject.host).to eql("example.com")
22
+ it 'returns the host' do
23
+ expect(subject.host).to eql('example.com')
25
24
  end
26
25
 
27
- it "returns its name" do
26
+ it 'returns its name' do
28
27
  expect(subject.name).to eql(:check)
29
28
  end
30
29
 
31
- it "returns the instance name" do
30
+ it 'returns the instance name' do
32
31
  expect(SiteInspector::Endpoint::Check.name).to eql(:check)
33
32
  end
34
33
 
35
- it "enables and disables the check" do
34
+ it 'enables and disables the check' do
36
35
  expect(SiteInspector::Endpoint::Check.enabled?).to eql(true)
37
36
  SiteInspector::Endpoint::Check.enabled = false
38
37
  expect(SiteInspector::Endpoint::Check.enabled?).to eql(false)
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe SiteInspector::Endpoint::Content do
4
-
5
4
  subject do
6
5
  body = <<-eos
7
6
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
@@ -12,97 +11,97 @@ describe SiteInspector::Endpoint::Content do
12
11
  </html>
13
12
  eos
14
13
 
15
- stub_request(:get, "http://example.com/").
16
- to_return(:status => 200, :body => body )
17
- stub_request(:head, "http://example.com/").
18
- to_return(:status => 200 )
19
- endpoint = SiteInspector::Endpoint.new("http://example.com")
14
+ stub_request(:get, 'http://example.com/')
15
+ .to_return(status: 200, body: body)
16
+ stub_request(:head, 'http://example.com/')
17
+ .to_return(status: 200)
18
+ endpoint = SiteInspector::Endpoint.new('http://example.com')
20
19
  SiteInspector::Endpoint::Content.new(endpoint)
21
20
  end
22
21
 
23
- it "returns the doc" do
22
+ it 'returns the doc' do
24
23
  expect(subject.document.class).to eql(Nokogiri::HTML::Document)
25
- expect(subject.document.css("h1").text).to eql("Some page")
24
+ expect(subject.document.css('h1').text).to eql('Some page')
26
25
  end
27
26
 
28
- it "returns the body" do
29
- expect(subject.body).to match("<h1>Some page</h1>")
27
+ it 'returns the body' do
28
+ expect(subject.body).to match('<h1>Some page</h1>')
30
29
  end
31
30
 
32
- it "returns the doctype" do
33
- expect(subject.doctype).to eql("-//W3C//DTD XHTML 1.0 Transitional//EN")
31
+ it 'returns the doctype' do
32
+ expect(subject.doctype).to eql('-//W3C//DTD XHTML 1.0 Transitional//EN')
34
33
  end
35
34
 
36
- it "knows when robots.txt exists" do
37
- stub_request(:head, /http\:\/\/example.com\/[a-z0-9]{32}/i).to_return(:status => 404)
35
+ it 'knows when robots.txt exists' do
36
+ stub_request(:head, %r{http\://example.com/[a-z0-9]{32}}i).to_return(status: 404)
38
37
 
39
- stub_request(:head, "http://example.com/robots.txt").
40
- to_return(:status => 200)
38
+ stub_request(:head, 'http://example.com/robots.txt')
39
+ .to_return(status: 200)
41
40
  expect(subject.robots_txt?).to eql(true)
42
41
  end
43
42
 
44
43
  it "knows when robots.txt doesn't exist" do
45
- stub_request(:head, /http\:\/\/example.com\/[a-z0-9]{32}/i).to_return(:status => 404)
44
+ stub_request(:head, %r{http\://example.com/[a-z0-9]{32}}i).to_return(status: 404)
46
45
 
47
- stub_request(:head, "http://example.com/robots.txt").
48
- to_return(:status => 404)
46
+ stub_request(:head, 'http://example.com/robots.txt')
47
+ .to_return(status: 404)
49
48
  expect(subject.robots_txt?).to eql(false)
50
49
  end
51
50
 
52
- it "knows when sitemap.xml exists" do
53
- stub_request(:head, /http\:\/\/example.com\/[a-z0-9]{32}/i).to_return(:status => 404)
51
+ it 'knows when sitemap.xml exists' do
52
+ stub_request(:head, %r{http\://example.com/[a-z0-9]{32}}i).to_return(status: 404)
54
53
 
55
- stub_request(:head, "http://example.com/sitemap.xml").
56
- to_return(:status => 200)
54
+ stub_request(:head, 'http://example.com/sitemap.xml')
55
+ .to_return(status: 200)
57
56
  expect(subject.sitemap_xml?).to eql(true)
58
57
  end
59
58
 
60
- it "knows when sitemap.xml exists" do
61
- stub_request(:head, /http\:\/\/example.com\/[a-z0-9]{32}/i).to_return(:status => 404)
59
+ it 'knows when sitemap.xml exists' do
60
+ stub_request(:head, %r{http\://example.com/[a-z0-9]{32}}i).to_return(status: 404)
62
61
 
63
- stub_request(:head, "http://example.com/sitemap.xml").
64
- to_return(:status => 404)
62
+ stub_request(:head, 'http://example.com/sitemap.xml')
63
+ .to_return(status: 404)
65
64
  expect(subject.sitemap_xml?).to eql(false)
66
65
  end
67
66
 
68
- it "knows when humans.txt exists" do
69
- stub_request(:head, /http\:\/\/example.com\/[a-z0-9]{32}/i).to_return(:status => 404)
67
+ it 'knows when humans.txt exists' do
68
+ stub_request(:head, %r{http\://example.com/[a-z0-9]{32}}i).to_return(status: 404)
70
69
 
71
- stub_request(:head, "http://example.com/humans.txt").
72
- to_return(:status => 200)
70
+ stub_request(:head, 'http://example.com/humans.txt')
71
+ .to_return(status: 200)
73
72
  expect(subject.humans_txt?).to eql(true)
74
73
  end
75
74
 
76
75
  it "knows when humans.txt doesn't exist" do
77
- stub_request(:head, /http\:\/\/example.com\/[a-z0-9]{32}/i).to_return(:status => 404)
76
+ stub_request(:head, %r{http\://example.com/[a-z0-9]{32}}i).to_return(status: 404)
78
77
 
79
- stub_request(:head, "http://example.com/humans.txt").
80
- to_return(:status => 200)
78
+ stub_request(:head, 'http://example.com/humans.txt')
79
+ .to_return(status: 200)
81
80
  expect(subject.humans_txt?).to eql(true)
82
81
  end
83
82
 
84
- context "404s" do
85
- it "knows when an endpoint returns a proper 404" do
86
- stub_request(:head, /http\:\/\/example.com\/.*/).
87
- to_return(:status => 404)
83
+ context '404s' do
84
+ it 'knows when an endpoint returns a proper 404' do
85
+ stub_request(:head, %r{http\://example.com/.*})
86
+ .to_return(status: 404)
88
87
  expect(subject.proper_404s?).to eql(true)
89
88
  end
90
89
 
91
90
  it "knows when an endpoint doesn't return a proper 404" do
92
- stub_request(:head, /http\:\/\/example.com\/[a-z0-9]{32}/i).
93
- to_return(:status => 200)
91
+ stub_request(:head, %r{http\://example.com/[a-z0-9]{32}}i)
92
+ .to_return(status: 200)
94
93
  expect(subject.proper_404s?).to eql(false)
95
94
  end
96
95
 
97
- it "generates a random path" do
96
+ it 'generates a random path' do
98
97
  path = subject.send(:random_path)
99
- expect(path).to match /[a-z0-9]{32}/i
98
+ expect(path).to match(/[a-z0-9]{32}/i)
100
99
  expect(subject.send(:random_path)).to eql(path)
101
100
  end
102
101
 
103
102
  it "doesn't say something exists when there are no 404s" do
104
- stub_request(:head, /http\:\/\/example.com\/[a-z0-9]{32}/i).to_return(:status => 200)
105
- stub_request(:head, "http://example.com/humans.txt").to_return(:status => 200)
103
+ stub_request(:head, %r{http\://example.com/[a-z0-9]{32}}i).to_return(status: 200)
104
+ stub_request(:head, 'http://example.com/humans.txt').to_return(status: 200)
106
105
  expect(subject.humans_txt?).to eql(nil)
107
106
  end
108
107
  end
@@ -1,51 +1,50 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe SiteInspector::Endpoint::Cookies do
4
-
5
- context "without cookies" do
4
+ context 'without cookies' do
6
5
  subject do
7
- stub_request(:head, "http://example.com/").
8
- to_return(:status => 200, :body => "" )
9
- endpoint = SiteInspector::Endpoint.new("http://example.com")
6
+ stub_request(:head, 'http://example.com/')
7
+ .to_return(status: 200, body: '')
8
+ endpoint = SiteInspector::Endpoint.new('http://example.com')
10
9
  SiteInspector::Endpoint::Cookies.new(endpoint)
11
10
  end
12
11
 
13
- it "knows when there are no cookies" do
12
+ it 'knows when there are no cookies' do
14
13
  expect(subject.cookies?).to eql(false)
15
14
  expect(subject.all).to eql(nil)
16
15
  end
17
16
  end
18
17
 
19
- context "with cookies" do
18
+ context 'with cookies' do
20
19
  subject do
21
20
  cookies = [
22
- CGI::Cookie::new(
23
- "name" => "foo",
24
- "value" => "bar",
25
- "domain" => "example.com",
26
- "path" => "/"
21
+ CGI::Cookie.new(
22
+ 'name' => 'foo',
23
+ 'value' => 'bar',
24
+ 'domain' => 'example.com',
25
+ 'path' => '/'
27
26
  ),
28
- CGI::Cookie::new(
29
- "name" => "foo2",
30
- "value" => "bar2",
31
- "domain" => "example.com",
32
- "path" => "/"
27
+ CGI::Cookie.new(
28
+ 'name' => 'foo2',
29
+ 'value' => 'bar2',
30
+ 'domain' => 'example.com',
31
+ 'path' => '/'
33
32
  )
34
- ].map { |c| c.to_s }
33
+ ].map(&:to_s)
35
34
 
36
- stub_request(:head, "http://example.com/").
37
- to_return(:status => 200, :body => "", :headers => { "set-cookie" => cookies })
38
- endpoint = SiteInspector::Endpoint.new("http://example.com")
35
+ stub_request(:head, 'http://example.com/')
36
+ .to_return(status: 200, body: '', headers: { 'set-cookie' => cookies })
37
+ endpoint = SiteInspector::Endpoint.new('http://example.com')
39
38
  SiteInspector::Endpoint::Cookies.new(endpoint)
40
39
  end
41
40
 
42
- it "knows when there are cookies" do
41
+ it 'knows when there are cookies' do
43
42
  expect(subject.cookies?).to eql(true)
44
43
  expect(subject.all.count).to eql(2)
45
44
  end
46
45
 
47
- it "returns a cookie by name" do
48
- expect(subject["foo"].to_s).to match(/foo=bar/)
46
+ it 'returns a cookie by name' do
47
+ expect(subject['foo'].to_s).to match(/foo=bar/)
49
48
  end
50
49
 
51
50
  it "knows cookies aren't secure" do
@@ -53,19 +52,19 @@ describe SiteInspector::Endpoint::Cookies do
53
52
  end
54
53
  end
55
54
 
56
- context "with secure cookies" do
55
+ context 'with secure cookies' do
57
56
  subject do
58
57
  cookies = [
59
- "foo=bar; domain=example.com; path=/; secure; HttpOnly",
60
- "foo2=bar2; domain=example.com; path=/"
58
+ 'foo=bar; domain=example.com; path=/; secure; HttpOnly',
59
+ 'foo2=bar2; domain=example.com; path=/'
61
60
  ]
62
- stub_request(:head, "http://example.com/").
63
- to_return(:status => 200, :body => "", :headers => { "set-cookie" => cookies })
64
- endpoint = SiteInspector::Endpoint.new("http://example.com")
61
+ stub_request(:head, 'http://example.com/')
62
+ .to_return(status: 200, body: '', headers: { 'set-cookie' => cookies })
63
+ endpoint = SiteInspector::Endpoint.new('http://example.com')
65
64
  SiteInspector::Endpoint::Cookies.new(endpoint)
66
65
  end
67
66
 
68
- it "knows cookies are secure" do
67
+ it 'knows cookies are secure' do
69
68
  expect(subject.secure?).to eql(true)
70
69
  end
71
70
  end