validate-website 1.9.0 → 1.11.0

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.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require File.expand_path('test_helper', __dir__)
2
4
 
3
5
  # rubocop:disable Metrics/BlockLength
@@ -17,7 +19,7 @@ describe ValidateWebsite::Static do
17
19
  not_found: false,
18
20
  exclude: /data|example/)
19
21
  end
20
- @validate_website.history_count.must_equal 0
22
+ _(@validate_website.history_count).must_equal 0
21
23
  end
22
24
 
23
25
  it 'no space in directory name' do
@@ -28,7 +30,7 @@ describe ValidateWebsite::Static do
28
30
  markup: false,
29
31
  not_found: false)
30
32
  end
31
- @validate_website.not_founds_count.must_equal 0
33
+ _(@validate_website.not_founds_count).must_equal 0
32
34
  end
33
35
 
34
36
  it 'not found' do
@@ -40,7 +42,25 @@ describe ValidateWebsite::Static do
40
42
  markup: false,
41
43
  not_found: true)
42
44
  end
43
- @validate_website.not_founds_count.must_equal 213
45
+ _(@validate_website.not_founds_count).must_equal 213
46
+ end
47
+ end
48
+
49
+ it 'can change validator' do
50
+ validator_res = File.join('test', 'data', 'validator.nu-failure.json')
51
+ stub_request(:any,
52
+ /#{ValidateWebsite::Validator.html5_validator_service_url}/)
53
+ .to_return(body: File.open(validator_res).read)
54
+ pattern = File.join(File.dirname(__FILE__), 'data',
55
+ 'html5-fail.html')
56
+ Dir.chdir('test/data') do
57
+ _out, _err = capture_io do
58
+ @validate_website.crawl(pattern: pattern,
59
+ site: 'http://w3.org/',
60
+ ignore: /Warning/,
61
+ html5_validator: :nu)
62
+ end
63
+ _(@validate_website.errors_count).must_equal 1
44
64
  end
45
65
  end
46
66
 
@@ -53,7 +73,7 @@ describe ValidateWebsite::Static do
53
73
  site: 'http://w3.org/',
54
74
  ignore: /height|width|Length/)
55
75
  end
56
- @validate_website.errors_count.must_equal 0
76
+ _(@validate_website.errors_count).must_equal 0
57
77
  end
58
78
  end
59
79
 
@@ -67,7 +87,7 @@ describe ValidateWebsite::Static do
67
87
  markup: false,
68
88
  css_syntax: true)
69
89
  end
70
- @validate_website.errors_count.must_equal 1
90
+ _(@validate_website.errors_count).must_equal 1
71
91
  end
72
92
  end
73
93
  end
@@ -1,19 +1,18 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  begin
4
- require 'coveralls'
5
- Coveralls.wear!
4
+ require 'simplecov'
5
+ SimpleCov.start
6
6
  rescue LoadError
7
- STDERR.puts 'coveralls not loaded'
7
+ warn 'simplecov not loaded'
8
8
  end
9
9
 
10
10
  require 'minitest/autorun'
11
- require 'minitest/focus'
12
11
  require 'spidr'
13
12
 
14
13
  require 'validate_website/core'
15
14
 
16
15
  require File.expand_path('webmock_helper', __dir__)
17
16
 
18
- TEST_DOMAIN = 'http://www.example.com/'.freeze
17
+ TEST_DOMAIN = 'http://www.example.com/'
19
18
  ENV['LC_ALL'] = 'C.UTF-8' if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require File.expand_path('test_helper', __dir__)
2
4
 
3
5
  # rubocop:disable Metrics/BlockLength
@@ -14,15 +16,15 @@ describe ValidateWebsite::Validator do
14
16
  name = 'w3.org-xhtml1-strict-errors'
15
17
  file = File.join('test', 'data', "#{name}.html")
16
18
  page = FakePage.new(name,
17
- body: open(file).read,
19
+ body: File.open(file).read,
18
20
  content_type: 'text/html')
19
21
  @xhtml1_page = @http.get_page(page.url)
20
22
  ignore = /width|height|Length/
21
23
  validator = subject.new(@xhtml1_page.doc,
22
24
  @xhtml1_page.body,
23
25
  ignore: ignore)
24
- validator.valid?.must_equal true
25
- validator.errors.must_equal []
26
+ _(validator.valid?).must_equal true
27
+ _(validator.errors).must_equal []
26
28
  end
27
29
 
28
30
  it 'xhtml1-strict should be valid' do
@@ -30,17 +32,17 @@ describe ValidateWebsite::Validator do
30
32
  dtd_uri = 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'
31
33
  file = File.join('test', 'data', "#{name}.html")
32
34
  page = FakePage.new(name,
33
- body: open(file).read,
35
+ body: File.open(file).read,
34
36
  content_type: 'text/html')
35
37
  @xhtml1_page = @http.get_page(page.url)
36
38
  ignore = /width|height|Length/
37
39
  validator = subject.new(@xhtml1_page.doc,
38
40
  @xhtml1_page.body,
39
41
  ignore: ignore)
40
- validator.dtd.system_id.must_equal dtd_uri
41
- validator.namespace.must_equal name
42
- validator.valid?.must_equal true
43
- validator.errors.must_equal []
42
+ _(validator.dtd.system_id).must_equal dtd_uri
43
+ _(validator.namespace).must_equal name
44
+ _(validator.valid?).must_equal true
45
+ _(validator.errors).must_equal []
44
46
  end
45
47
  end
46
48
 
@@ -49,18 +51,18 @@ describe ValidateWebsite::Validator do
49
51
  before do
50
52
  validator_res = File.join('test', 'data', 'validator.nu-success.json')
51
53
  stub_request(:any, /#{subject.html5_validator_service_url}/)
52
- .to_return(body: open(validator_res).read)
54
+ .to_return(body: File.open(validator_res).read)
53
55
  end
54
56
  it 'html5 should be valid' do
55
57
  name = 'html5'
56
58
  file = File.join('test', 'data', "#{name}.html")
57
59
  page = FakePage.new(name,
58
- body: open(file).read,
60
+ body: File.open(file).read,
59
61
  content_type: 'text/html')
60
62
  @html5_page = @http.get_page(page.url)
61
63
  validator = subject.new(@html5_page.doc,
62
64
  @html5_page.body)
63
- validator.valid?.must_equal true
65
+ _(validator.valid?).must_equal true
64
66
  end
65
67
  end
66
68
 
@@ -68,11 +70,11 @@ describe ValidateWebsite::Validator do
68
70
  before do
69
71
  validator_res = File.join('test', 'data', 'validator.nu-failure.json')
70
72
  stub_request(:any, /#{subject.html5_validator_service_url}/)
71
- .to_return(body: open(validator_res).read)
73
+ .to_return(body: File.open(validator_res).read)
72
74
  name = 'html5-fail'
73
75
  file = File.join('test', 'data', "#{name}.html")
74
76
  page = FakePage.new(name,
75
- body: open(file).read,
77
+ body: File.open(file).read,
76
78
  content_type: 'text/html')
77
79
  @html5_page = @http.get_page(page.url)
78
80
  end
@@ -82,8 +84,8 @@ describe ValidateWebsite::Validator do
82
84
  validator = subject.new(@html5_page.doc,
83
85
  @html5_page.body,
84
86
  html5_validator: :nu)
85
- validator.valid?.must_equal false
86
- validator.errors.size.must_equal 3
87
+ _(validator.valid?).must_equal false
88
+ _(validator.errors.size).must_equal 3
87
89
  end
88
90
 
89
91
  it 'should exclude errors ignored by :ignore option' do
@@ -92,8 +94,8 @@ describe ValidateWebsite::Validator do
92
94
  @html5_page.body,
93
95
  ignore: ignore,
94
96
  html5_validator: :nu)
95
- validator.valid?.must_equal false
96
- validator.errors.size.must_equal 1
97
+ _(validator.valid?).must_equal false
98
+ _(validator.errors.size).must_equal 1
97
99
  end
98
100
  end
99
101
 
@@ -101,8 +103,8 @@ describe ValidateWebsite::Validator do
101
103
  it 'should have an array of errors' do
102
104
  validator = subject.new(@html5_page.doc,
103
105
  @html5_page.body)
104
- validator.valid?.must_equal false
105
- validator.errors.size.must_equal 4
106
+ _(validator.valid?).must_equal false
107
+ _(validator.errors.size).must_equal 3
106
108
  end
107
109
 
108
110
  it 'should exclude errors ignored by :ignore option' do
@@ -110,8 +112,8 @@ describe ValidateWebsite::Validator do
110
112
  validator = subject.new(@html5_page.doc,
111
113
  @html5_page.body,
112
114
  ignore: ignore)
113
- validator.valid?.must_equal false
114
- validator.errors.size.must_equal 2
115
+ _(validator.valid?).must_equal false
116
+ _(validator.errors.size).must_equal 2
115
117
  end
116
118
  end
117
119
  end
@@ -122,13 +124,13 @@ describe ValidateWebsite::Validator do
122
124
  name = 'html4-strict'
123
125
  file = File.join('test', 'data', "#{name}.html")
124
126
  page = FakePage.new(name,
125
- body: open(file).read,
127
+ body: File.open(file).read,
126
128
  content_type: 'text/html')
127
129
  @html4_strict_page = @http.get_page(page.url)
128
130
  validator = subject.new(@html4_strict_page.doc,
129
131
  @html4_strict_page.body)
130
132
  validator.valid?
131
- validator.errors.must_equal []
133
+ _(validator.errors).must_equal []
132
134
  end
133
135
  end
134
136
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'webmock/minitest'
2
4
 
3
5
  # FakePage html helper for webmock
@@ -27,8 +29,8 @@ class FakePage
27
29
 
28
30
  def create_body
29
31
  @body = '<html><body>'
30
- @links.each { |l| @body += "<a href=\"#{TEST_DOMAIN}#{l}\"></a>" } if @links
31
- @hrefs.each { |h| @body += "<a href=\"#{h}\"></a>" } if @hrefs
32
+ @links&.each { |l| @body += "<a href=\"#{TEST_DOMAIN}#{l}\"></a>" }
33
+ @hrefs&.each { |h| @body += "<a href=\"#{h}\"></a>" }
32
34
  @body += '</body></html>'
33
35
  end
34
36
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: validate-website
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.0
4
+ version: 1.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Laurent Arnoud
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-25 00:00:00.000000000 Z
11
+ date: 2021-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: crass
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0.1'
75
+ version: '1.0'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0.1'
82
+ version: '1.0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: w3c_validators
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -95,47 +95,47 @@ dependencies:
95
95
  - !ruby/object:Gem::Version
96
96
  version: '1.3'
97
97
  - !ruby/object:Gem::Dependency
98
- name: asciidoctor
98
+ name: webrick
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '1.5'
104
- type: :development
103
+ version: '1'
104
+ type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '1.5'
110
+ version: '1'
111
111
  - !ruby/object:Gem::Dependency
112
- name: minitest
112
+ name: asciidoctor
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '5'
117
+ version: '1.5'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '5'
124
+ version: '1.5'
125
125
  - !ruby/object:Gem::Dependency
126
- name: minitest-focus
126
+ name: minitest
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '1'
131
+ version: '5.0'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '1'
138
+ version: '5.0'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: rake
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -156,14 +156,14 @@ dependencies:
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: 0.58.0
159
+ version: 0.76.0
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: 0.58.0
166
+ version: 0.76.0
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: webmock
169
169
  requirement: !ruby/object:Gem::Requirement
@@ -273,15 +273,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
273
273
  requirements:
274
274
  - - ">="
275
275
  - !ruby/object:Gem::Version
276
- version: 2.2.0
276
+ version: '2.5'
277
277
  required_rubygems_version: !ruby/object:Gem::Requirement
278
278
  requirements:
279
279
  - - ">="
280
280
  - !ruby/object:Gem::Version
281
281
  version: '0'
282
282
  requirements: []
283
- rubyforge_project:
284
- rubygems_version: 2.7.6
283
+ rubygems_version: 3.2.0.rc.2
285
284
  signing_key:
286
285
  specification_version: 4
287
286
  summary: Web crawler for checking the validity of your documents