capybara-validate_html5 1.1.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +4 -0
- data/MIT-LICENSE +1 -1
- data/README.rdoc +12 -9
- data/lib/capybara/optionally_validate_html5.rb +2 -0
- data/lib/capybara/validate_html5.rb +7 -2
- metadata +8 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f32ed1925ec14c9311dd217c9b7d0639d79fef0040d5b6f21393f5553267ec3
|
4
|
+
data.tar.gz: a39dab6f833867d06d5cac1260693588885788f3de193234b1789a71121d737e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf51d9e611941e92ab1c5aeca7b9d70e660e39a72ff07d95d8fe8389160095141fa8a67d6ef5493d455216c539e5745dbf851d3558fe47abdf32d96fa4f7230f
|
7
|
+
data.tar.gz: 67ceffa7c755f7460c0806675cae0bd72176100ca8b9abd6842eabe71ef091dd4b3876bdd8fd4119e9b84148d3401091d1d0ab9eb75b144d8c4b07747b4edf39
|
data/CHANGELOG
CHANGED
data/MIT-LICENSE
CHANGED
data/README.rdoc
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
= capybara-validate_html5
|
2
2
|
|
3
|
-
capybara-validate_html5 validates the HTML5 for each page
|
3
|
+
capybara-validate_html5 validates the HTML5 for each page parsed, and
|
4
4
|
fails if there are any HTML5 parse errors on the page. This makes
|
5
5
|
it easy to automatically test for HTML5 validity when running your
|
6
6
|
normal capybara test suite.
|
7
7
|
|
8
|
-
This only works for the rack-test driver
|
9
|
-
minitest-global_expectations for testing.
|
8
|
+
This only works for the rack-test driver.
|
10
9
|
|
11
10
|
= Installation
|
12
11
|
|
@@ -18,9 +17,7 @@ Source code is available on GitHub at https://github.com/jeremyevans/capybara-va
|
|
18
17
|
|
19
18
|
= Examples
|
20
19
|
|
21
|
-
require 'capybara'
|
22
20
|
require 'capybara/validate_html5'
|
23
|
-
require 'minitest/global_expectations'
|
24
21
|
|
25
22
|
describe 'capybara-validate_html5' do
|
26
23
|
include Rack::Test::Methods
|
@@ -31,13 +28,19 @@ Source code is available on GitHub at https://github.com/jeremyevans/capybara-va
|
|
31
28
|
end
|
32
29
|
|
33
30
|
it "should allow restoring of state" do
|
34
|
-
visit '/' #
|
31
|
+
visit '/' # No validation on retrieval
|
32
|
+
page.body # No validation on body access
|
35
33
|
|
34
|
+
page.all("a") # Attempt to parse body, validates HTML, raises exception if not valid
|
35
|
+
page.all("a") # No validation, as same body already parsed
|
36
|
+
|
37
|
+
visit '/page1'
|
38
|
+
click_link 'Go Somewhere' # Attempt to parse body, validates HTML, raises exception if not valid
|
39
|
+
|
40
|
+
visit '/page2'
|
36
41
|
skip_html_validation do
|
37
|
-
click_button 'Submit' #
|
42
|
+
click_button 'Submit' # No validation, as it was explicitly skipped
|
38
43
|
end
|
39
|
-
|
40
|
-
click_link 'Go Somewhere' # validates HTML, fails spec if not valid
|
41
44
|
end
|
42
45
|
end
|
43
46
|
|
@@ -2,6 +2,7 @@ require 'capybara'
|
|
2
2
|
|
3
3
|
if Capybara.respond_to?(:use_html5_parsing) && defined?(Nokogiri::HTML5)
|
4
4
|
require_relative 'validate_html5'
|
5
|
+
# :nocov:
|
5
6
|
else
|
6
7
|
module Capybara::DSL
|
7
8
|
# If HTML5 validation isn't supported, make this a no-op.
|
@@ -9,4 +10,5 @@ else
|
|
9
10
|
yield
|
10
11
|
end
|
11
12
|
end
|
13
|
+
# :nocov:
|
12
14
|
end
|
@@ -1,15 +1,20 @@
|
|
1
1
|
require 'capybara'
|
2
2
|
|
3
3
|
module Capybara
|
4
|
+
# Exception class raised for HTML5 validations
|
5
|
+
class HTML5ValidationError < StandardError
|
6
|
+
end
|
7
|
+
|
8
|
+
# :nocov:
|
4
9
|
unless Capybara.respond_to?(:use_html5_parsing) && defined?(Nokogiri::HTML5)
|
5
10
|
raise LoadError, "capybara-validate_html5 cannot be used as Capybara or Nokogiri doesn't support HTML5 parsing (require capybara/optionally_validate_html5 to make validation optional)"
|
6
11
|
end
|
12
|
+
# :nocov:
|
7
13
|
|
8
14
|
self.use_html5_parsing = true
|
9
15
|
|
10
16
|
require 'capybara/rack_test/browser'
|
11
17
|
require 'capybara/dsl'
|
12
|
-
require 'minitest'
|
13
18
|
|
14
19
|
module RackTest::ValidateDom
|
15
20
|
# Skip HTML validation inside the block.
|
@@ -45,7 +50,7 @@ END_MSG
|
|
45
50
|
error_info << error.to_s << "\n" << html_lines[begin_line..end_line].join("\n") << "\n\n"
|
46
51
|
end
|
47
52
|
|
48
|
-
errors.size
|
53
|
+
raise HTML5ValidationError, "#{errors.size} HTML5 validation errors: #{error_info}"
|
49
54
|
end
|
50
55
|
end
|
51
56
|
super
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capybara-validate_html5
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Evans
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2024-12-31 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: rack-test
|
@@ -45,7 +44,7 @@ dependencies:
|
|
45
44
|
- - ">="
|
46
45
|
- !ruby/object:Gem::Version
|
47
46
|
version: '0'
|
48
|
-
type: :
|
47
|
+
type: :development
|
49
48
|
prerelease: false
|
50
49
|
version_requirements: !ruby/object:Gem::Requirement
|
51
50
|
requirements:
|
@@ -59,7 +58,7 @@ dependencies:
|
|
59
58
|
- - ">="
|
60
59
|
- !ruby/object:Gem::Version
|
61
60
|
version: '0'
|
62
|
-
type: :
|
61
|
+
type: :development
|
63
62
|
prerelease: false
|
64
63
|
version_requirements: !ruby/object:Gem::Requirement
|
65
64
|
requirements:
|
@@ -67,7 +66,7 @@ dependencies:
|
|
67
66
|
- !ruby/object:Gem::Version
|
68
67
|
version: '0'
|
69
68
|
description: |
|
70
|
-
capybara-validate validates the HTML5 for each page
|
69
|
+
capybara-validate validates the HTML5 for each page parsed, and
|
71
70
|
fails if there are any HTML5 parse errors on the page. This makes
|
72
71
|
it easy to automatically test for HTML5 validity when running your
|
73
72
|
normal capybara test suite.
|
@@ -91,13 +90,12 @@ metadata:
|
|
91
90
|
bug_tracker_uri: https://github.com/jeremyevans/capybara-validate_html5/issues
|
92
91
|
changelog_uri: https://github.com/jeremyevans/capybara-validate_html5/blob/master/CHANGELOG
|
93
92
|
source_code_uri: https://github.com/jeremyevans/capybara-validate_html5
|
94
|
-
post_install_message:
|
95
93
|
rdoc_options:
|
96
94
|
- "--quiet"
|
97
95
|
- "--line-numbers"
|
98
96
|
- "--inline-source"
|
99
97
|
- "--title"
|
100
|
-
- 'capybara-validate: Validate HTML5 for each page
|
98
|
+
- 'capybara-validate: Validate HTML5 for each page parsed'
|
101
99
|
- "--main"
|
102
100
|
- README.rdoc
|
103
101
|
require_paths:
|
@@ -113,8 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
113
111
|
- !ruby/object:Gem::Version
|
114
112
|
version: '0'
|
115
113
|
requirements: []
|
116
|
-
rubygems_version: 3.
|
117
|
-
signing_key:
|
114
|
+
rubygems_version: 3.6.2
|
118
115
|
specification_version: 4
|
119
|
-
summary: Validate HTML5 for each page
|
116
|
+
summary: Validate HTML5 for each page parsed
|
120
117
|
test_files: []
|