rspec-html 0.1.0 → 0.2.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 +4 -4
- data/.gitignore +2 -0
- data/.rubocop.yml +51 -0
- data/Gemfile.lock +42 -28
- data/README.md +82 -13
- data/lib/rspec/html.rb +18 -4
- data/lib/rspec/html/version.rb +3 -3
- data/lib/rspec_html.rb +16 -0
- data/lib/rspec_html/element.rb +15 -0
- data/lib/rspec_html/nameable.rb +8 -0
- data/lib/rspec_html/searchable.rb +117 -0
- data/lib/rspec_html/tags.rb +27 -0
- data/rspec-html.gemspec +8 -4
- metadata +70 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d34bf3daf886cca4a7e1b50de449025cd6255629a1fb6a5f6d319c6353fedb0a
|
|
4
|
+
data.tar.gz: 7f3ae650fa77a60700211ccda0cb3478e034d8b14f22a40375b89ed007ecb843
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a0ae4675dfe2790a31f953e089ce97157f6b736967abc96281eb50adc04641e1725765085be03770686dbff3c8ccd8d2fa4d567fd366edaabb74c7f2348f5e27
|
|
7
|
+
data.tar.gz: '0384ab293fe9397088d0c6356585d1c0657a443ba7a2be8ed1d6a8cdd05ada3b173adc7138091db29b4eedf0c3a267360231735fe1d9fa53144ee64f7367bf39'
|
data/.gitignore
CHANGED
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
Metrics/BlockLength:
|
|
2
|
+
Exclude:
|
|
3
|
+
- 'spec/**/*'
|
|
4
|
+
- 'rspec-html.gemspec'
|
|
5
|
+
|
|
6
|
+
Layout/EmptyLinesAroundAttributeAccessor:
|
|
7
|
+
Enabled: true
|
|
8
|
+
Layout/SpaceAroundMethodCallOperator:
|
|
9
|
+
Enabled: true
|
|
10
|
+
Lint/DeprecatedOpenSSLConstant:
|
|
11
|
+
Enabled: true
|
|
12
|
+
Lint/DuplicateElsifCondition:
|
|
13
|
+
Enabled: true
|
|
14
|
+
Lint/MixedRegexpCaptureTypes:
|
|
15
|
+
Enabled: true
|
|
16
|
+
Lint/RaiseException:
|
|
17
|
+
Enabled: true
|
|
18
|
+
Lint/StructNewOverride:
|
|
19
|
+
Enabled: true
|
|
20
|
+
Style/AccessorGrouping:
|
|
21
|
+
Enabled: true
|
|
22
|
+
Style/ArrayCoercion:
|
|
23
|
+
Enabled: true
|
|
24
|
+
Style/BisectedAttrAccessor:
|
|
25
|
+
Enabled: true
|
|
26
|
+
Style/CaseLikeIf:
|
|
27
|
+
Enabled: true
|
|
28
|
+
Style/ExponentialNotation:
|
|
29
|
+
Enabled: true
|
|
30
|
+
Style/HashAsLastArrayItem:
|
|
31
|
+
Enabled: true
|
|
32
|
+
Style/HashEachMethods:
|
|
33
|
+
Enabled: true
|
|
34
|
+
Style/HashLikeCase:
|
|
35
|
+
Enabled: true
|
|
36
|
+
Style/HashTransformKeys:
|
|
37
|
+
Enabled: true
|
|
38
|
+
Style/HashTransformValues:
|
|
39
|
+
Enabled: true
|
|
40
|
+
Style/RedundantAssignment:
|
|
41
|
+
Enabled: true
|
|
42
|
+
Style/RedundantFetchBlock:
|
|
43
|
+
Enabled: true
|
|
44
|
+
Style/RedundantFileExtensionInRequire:
|
|
45
|
+
Enabled: true
|
|
46
|
+
Style/RedundantRegexpCharacterClass:
|
|
47
|
+
Enabled: true
|
|
48
|
+
Style/RedundantRegexpEscape:
|
|
49
|
+
Enabled: true
|
|
50
|
+
Style/SlicingWithRange:
|
|
51
|
+
Enabled: true
|
data/Gemfile.lock
CHANGED
|
@@ -1,66 +1,80 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
rspec-html (0.1
|
|
4
|
+
rspec-html (0.2.1)
|
|
5
|
+
nokogiri (~> 1.10)
|
|
5
6
|
rspec (~> 3.0)
|
|
6
7
|
|
|
7
8
|
GEM
|
|
8
9
|
remote: https://rubygems.org/
|
|
9
10
|
specs:
|
|
10
|
-
ast (2.4.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
ast (2.4.1)
|
|
12
|
+
byebug (11.1.3)
|
|
13
|
+
concurrent-ruby (1.1.6)
|
|
14
|
+
devpack (0.1.2)
|
|
15
|
+
diff-lcs (1.4.4)
|
|
16
|
+
i18n (1.8.5)
|
|
14
17
|
concurrent-ruby (~> 1.0)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
mini_portile2 (2.4.0)
|
|
19
|
+
nokogiri (1.10.10)
|
|
20
|
+
mini_portile2 (~> 2.4.0)
|
|
21
|
+
paint (2.2.0)
|
|
22
|
+
parallel (1.19.2)
|
|
23
|
+
parser (2.7.1.4)
|
|
24
|
+
ast (~> 2.4.1)
|
|
20
25
|
rainbow (3.0.0)
|
|
21
|
-
rake (
|
|
26
|
+
rake (13.0.1)
|
|
27
|
+
regexp_parser (1.7.1)
|
|
28
|
+
rexml (3.2.4)
|
|
22
29
|
rspec (3.9.0)
|
|
23
30
|
rspec-core (~> 3.9.0)
|
|
24
31
|
rspec-expectations (~> 3.9.0)
|
|
25
32
|
rspec-mocks (~> 3.9.0)
|
|
26
|
-
rspec-core (3.9.
|
|
27
|
-
rspec-support (~> 3.9.
|
|
28
|
-
rspec-expectations (3.9.
|
|
33
|
+
rspec-core (3.9.2)
|
|
34
|
+
rspec-support (~> 3.9.3)
|
|
35
|
+
rspec-expectations (3.9.2)
|
|
29
36
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
30
37
|
rspec-support (~> 3.9.0)
|
|
31
38
|
rspec-its (1.3.0)
|
|
32
39
|
rspec-core (>= 3.0.0)
|
|
33
40
|
rspec-expectations (>= 3.0.0)
|
|
34
|
-
rspec-mocks (3.9.
|
|
41
|
+
rspec-mocks (3.9.1)
|
|
35
42
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
36
43
|
rspec-support (~> 3.9.0)
|
|
37
|
-
rspec-support (3.9.
|
|
38
|
-
rubocop (0.
|
|
39
|
-
jaro_winkler (~> 1.5.1)
|
|
44
|
+
rspec-support (3.9.3)
|
|
45
|
+
rubocop (0.88.0)
|
|
40
46
|
parallel (~> 1.10)
|
|
41
|
-
parser (>= 2.
|
|
47
|
+
parser (>= 2.7.1.1)
|
|
42
48
|
rainbow (>= 2.2.2, < 4.0)
|
|
49
|
+
regexp_parser (>= 1.7)
|
|
50
|
+
rexml
|
|
51
|
+
rubocop-ast (>= 0.1.0, < 1.0)
|
|
43
52
|
ruby-progressbar (~> 1.7)
|
|
44
|
-
unicode-display_width (>= 1.4.0, <
|
|
45
|
-
rubocop-
|
|
46
|
-
|
|
53
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
|
54
|
+
rubocop-ast (0.2.0)
|
|
55
|
+
parser (>= 2.7.0.1)
|
|
56
|
+
rubocop-rspec (1.42.0)
|
|
57
|
+
rubocop (>= 0.87.0)
|
|
47
58
|
ruby-progressbar (1.10.1)
|
|
48
|
-
strong_versions (0.
|
|
49
|
-
i18n (>= 0.5
|
|
59
|
+
strong_versions (0.4.5)
|
|
60
|
+
i18n (>= 0.5)
|
|
50
61
|
paint (~> 2.0)
|
|
51
|
-
unicode-display_width (1.
|
|
62
|
+
unicode-display_width (1.7.0)
|
|
52
63
|
|
|
53
64
|
PLATFORMS
|
|
54
65
|
ruby
|
|
55
66
|
|
|
56
67
|
DEPENDENCIES
|
|
57
68
|
bundler (~> 2.0)
|
|
58
|
-
|
|
69
|
+
byebug (~> 11.0)
|
|
70
|
+
devpack (~> 0.1.2)
|
|
71
|
+
i18n (~> 1.7)
|
|
72
|
+
rake (~> 13.0)
|
|
59
73
|
rspec-html!
|
|
60
74
|
rspec-its (~> 1.3)
|
|
61
|
-
rubocop (~> 0.
|
|
75
|
+
rubocop (~> 0.88.0)
|
|
62
76
|
rubocop-rspec (~> 1.36)
|
|
63
|
-
strong_versions (~> 0.
|
|
77
|
+
strong_versions (~> 0.4.5)
|
|
64
78
|
|
|
65
79
|
BUNDLED WITH
|
|
66
80
|
2.0.2
|
data/README.md
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
#
|
|
1
|
+
# RSpec::HTML
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
|
3
|
+
_RSpec::HTML_ provides a simple object interface to HTML responses from [_RSpec Rails_ request specs](https://relishapp.com/rspec/rspec-rails/docs/request-specs/request-spec).
|
|
6
4
|
|
|
7
5
|
## Installation
|
|
8
6
|
|
|
9
|
-
Add this line to your application's Gemfile:
|
|
10
|
-
|
|
11
7
|
```ruby
|
|
12
|
-
gem 'rspec-html'
|
|
8
|
+
gem 'rspec-html', '~> 0.2.1'
|
|
13
9
|
```
|
|
14
10
|
|
|
11
|
+
Bundle
|
|
15
12
|
And then execute:
|
|
16
13
|
|
|
17
14
|
$ bundle
|
|
@@ -22,18 +19,90 @@ Or install it yourself as:
|
|
|
22
19
|
|
|
23
20
|
## Usage
|
|
24
21
|
|
|
25
|
-
|
|
22
|
+
Require the gem in your `spec_helper.rb`:
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
# spec/spec_helper.rb
|
|
26
|
+
require 'rspec/html'
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Object Interface
|
|
30
|
+
|
|
31
|
+
The top-level object `document` is available in all tests which reflects the current response body (e.g. in request specs).
|
|
32
|
+
|
|
33
|
+
If you need to parse _HTML_ manually you can use the provided `parse_html` helper and then access `document` as normal:
|
|
34
|
+
|
|
35
|
+
```ruby
|
|
36
|
+
before { parse_html('<html><body>hello</body></html>') }
|
|
37
|
+
it 'says hello' do
|
|
38
|
+
expect(document.body).to include 'hello'
|
|
39
|
+
end
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
To navigate the _DOM_ by a sequence of tag names use chained method calls on the `document` object:
|
|
43
|
+
|
|
44
|
+
#### Tag Traversal
|
|
45
|
+
```ruby
|
|
46
|
+
expect(document.body.div.span).to include 'some text'
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
#### Attribute Matching
|
|
50
|
+
To select an element matching certain attributes pass a hash to any of the chained methods:
|
|
51
|
+
```ruby
|
|
52
|
+
expect(document.body.div(id: 'my-div').span(align: 'left')).to include 'some text'
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
#### Class Matching
|
|
56
|
+
CSS classes are treated as a special case: to select an element matching a specific class (or array of classes) pass the `class` parameter:
|
|
57
|
+
```ruby
|
|
58
|
+
expect(document.body.div(id: 'my-div').span(class: 'my-class')).to include 'some text'
|
|
59
|
+
expect(document.body.div(id: 'my-div').span(class: ['my-class', 'my-other-class'])).to include 'some text'
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
#### Attribute Retrieval
|
|
63
|
+
To select an attribute from an element use the hash-style interface:
|
|
64
|
+
```ruby
|
|
65
|
+
expect(document.body.div.span[:class]).to include 'my-class'
|
|
66
|
+
expect(document.body.div.span['data-content']).to include 'my content'
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
#### Indexing a Matching Set
|
|
70
|
+
To select an index from a set of matched elements use the array-style interface (the first matching element is `1`, not `0`):
|
|
71
|
+
```ruby
|
|
72
|
+
expect(document.body.div[1].span[1][:class]).to include 'my-class'
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
#### Element Existence
|
|
76
|
+
To test if a matching element was found use the `exist` matcher:
|
|
77
|
+
```ruby
|
|
78
|
+
expect(document.body.div[1]).to exist
|
|
79
|
+
expect(document.body.div[4]).to_not exist
|
|
80
|
+
```
|
|
26
81
|
|
|
27
|
-
|
|
82
|
+
#### Length of matched attributes
|
|
83
|
+
To test the length of matched elements use the `#size` or `#length` method:
|
|
84
|
+
```ruby
|
|
85
|
+
expect(document.body.div.size).to eql 3
|
|
86
|
+
expect(document.body.div.length).to eql 3
|
|
87
|
+
```
|
|
28
88
|
|
|
29
|
-
|
|
89
|
+
#### XPath / CSS Selectors
|
|
90
|
+
If you need something more specific you can always use the _Nokogiri_ `#xpath` and `#css` methods on any element:
|
|
91
|
+
```ruby
|
|
92
|
+
expect(document.body.xpath('//span[@class="my-class"]')).to include 'some text'
|
|
93
|
+
expect(document.body.css('span.my-class')).to include 'some text'
|
|
94
|
+
```
|
|
30
95
|
|
|
31
|
-
To
|
|
96
|
+
To simply check that an _XPath_ or _CSS_ selector exists use `have_xpath` and `have_css`:
|
|
97
|
+
```ruby
|
|
98
|
+
expect(document.body).to have_css 'html body div.myclass'
|
|
99
|
+
expect(document.body).to have_xpath '//html/body/div[@class="myclass"]'
|
|
100
|
+
```
|
|
32
101
|
|
|
33
102
|
## Contributing
|
|
34
103
|
|
|
35
|
-
|
|
104
|
+
Feel free to make a pull request.
|
|
36
105
|
|
|
37
106
|
## License
|
|
38
107
|
|
|
39
|
-
|
|
108
|
+
[MIT License](LICENSE)
|
data/lib/rspec/html.rb
CHANGED
|
@@ -1,10 +1,24 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require 'rspec'
|
|
4
|
+
require 'rspec_html'
|
|
5
|
+
|
|
3
6
|
require 'rspec/html/version'
|
|
4
7
|
|
|
5
|
-
module
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
module RSpec
|
|
9
|
+
# Module extension for RSpec::SharedContext
|
|
10
|
+
module HTML
|
|
11
|
+
def document
|
|
12
|
+
@document || RSpecHTML::Element.new(Nokogiri::HTML.parse(response.body), :document)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def parse_html(content)
|
|
16
|
+
@document = RSpecHTML::Element.new(Nokogiri::HTML.parse(content), :document)
|
|
17
|
+
end
|
|
9
18
|
end
|
|
10
19
|
end
|
|
20
|
+
|
|
21
|
+
RSpec.configure do |config|
|
|
22
|
+
config.include RSpec::HTML
|
|
23
|
+
config.backtrace_exclusion_patterns << %r{/lib/rspec/html}
|
|
24
|
+
end
|
data/lib/rspec/html/version.rb
CHANGED
data/lib/rspec_html.rb
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'nokogiri'
|
|
4
|
+
require 'pathname'
|
|
5
|
+
|
|
6
|
+
require 'rspec_html/nameable'
|
|
7
|
+
require 'rspec_html/searchable'
|
|
8
|
+
require 'rspec_html/element'
|
|
9
|
+
require 'rspec_html/tags'
|
|
10
|
+
|
|
11
|
+
# Support module for rspec/html
|
|
12
|
+
module RSpecHTML
|
|
13
|
+
def self.root
|
|
14
|
+
Pathname.new(__dir__).parent
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module RSpecHTML
|
|
4
|
+
# HTML DOM element abstraction
|
|
5
|
+
class Element
|
|
6
|
+
include Searchable
|
|
7
|
+
include Nameable
|
|
8
|
+
|
|
9
|
+
def initialize(element, name, siblings: [])
|
|
10
|
+
@name = name
|
|
11
|
+
@element = element
|
|
12
|
+
@siblings = siblings
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module RSpecHTML
|
|
4
|
+
# Mixin module providing methods for searching text content of HTML entities
|
|
5
|
+
module Searchable
|
|
6
|
+
def include?(val)
|
|
7
|
+
@element.text.include?(val)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def css(*args)
|
|
11
|
+
self.class.new(@element&.css(*args), :css)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def xpath(*args)
|
|
15
|
+
self.class.new(@element&.xpath(*args), :xpath)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def present?
|
|
19
|
+
!@element.nil?
|
|
20
|
+
end
|
|
21
|
+
alias exist? present?
|
|
22
|
+
|
|
23
|
+
# rubocop:disable Naming/PredicateName
|
|
24
|
+
def has_css?(*args)
|
|
25
|
+
!@element&.css(*args)&.empty?
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def has_xpath?(*args)
|
|
29
|
+
!@element&.xpath(*args)&.empty?
|
|
30
|
+
end
|
|
31
|
+
# rubocop:enable Naming/PredicateName
|
|
32
|
+
|
|
33
|
+
def to_s
|
|
34
|
+
@element&.text&.strip
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def inspect
|
|
38
|
+
%("#{@element}")
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def [](val)
|
|
42
|
+
return index(val) if val.is_a?(Integer)
|
|
43
|
+
return range(val) if val.is_a?(Range)
|
|
44
|
+
|
|
45
|
+
@element&.attr(val.to_s)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def size
|
|
49
|
+
return @element.size if @element.respond_to?(:size)
|
|
50
|
+
|
|
51
|
+
@siblings.size
|
|
52
|
+
end
|
|
53
|
+
alias length size
|
|
54
|
+
|
|
55
|
+
private
|
|
56
|
+
|
|
57
|
+
def method_missing(tag, *args)
|
|
58
|
+
return super unless Tags.include?(tag)
|
|
59
|
+
return self.class.new(find(tag), tag, siblings: find(tag, all: true)) if args.empty?
|
|
60
|
+
|
|
61
|
+
self.class.new(where(tag, args.first), tag, siblings: where(tag, args.first, all: true))
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def index(val)
|
|
65
|
+
zero_index_error if val.zero?
|
|
66
|
+
self.class.new(@siblings[val - 1], name)
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def range(val)
|
|
70
|
+
zero_index_error if val.first.zero?
|
|
71
|
+
self.class.new(@siblings[(val.first - 1)..(val.last - 1)], :range)
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def zero_index_error
|
|
75
|
+
raise ArgumentError, 'Index for matched sets starts at 1, not 0.'
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def where(tag, query, all: false)
|
|
79
|
+
matched = if query[:class]
|
|
80
|
+
where_class(tag, query[:class]) & where_xpath(tag, query.merge(class: nil))
|
|
81
|
+
else
|
|
82
|
+
where_xpath(tag, query)
|
|
83
|
+
end
|
|
84
|
+
return matched&.first unless all
|
|
85
|
+
|
|
86
|
+
matched
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def where_xpath(tag, query)
|
|
90
|
+
conditions = "[#{where_conditions(query)}]" unless query.compact.empty?
|
|
91
|
+
@element&.xpath("//#{tag}#{conditions}")
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def where_conditions(query)
|
|
95
|
+
query.compact.map do |key, value|
|
|
96
|
+
next if value.nil?
|
|
97
|
+
|
|
98
|
+
%(@#{key}="#{value}")
|
|
99
|
+
end.join ' and '
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def where_class(tag, class_or_classes)
|
|
103
|
+
selector = class_or_classes.is_a?(Array) ? class_or_classes.join('.') : class_or_classes
|
|
104
|
+
@element&.css("#{tag}.#{selector}")
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def find(tag, all: false)
|
|
108
|
+
return @element&.css(tag.to_s)&.first unless all
|
|
109
|
+
|
|
110
|
+
@element&.css(tag.to_s)
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
def respond_to_missing?(method_name, *_)
|
|
114
|
+
Tags.include?(method_name)
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module RSpecHTML
|
|
4
|
+
# HTML tag identification, used to determine viability for DOM traversal via chained methods.
|
|
5
|
+
class Tags
|
|
6
|
+
def self.include?(val)
|
|
7
|
+
tags.include?(val.to_s.upcase)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
# rubocop:disable Metrics/MethodLength
|
|
11
|
+
def self.tags
|
|
12
|
+
%w[
|
|
13
|
+
A ABBR ACRONYM ADDRESS APPLET AREA ARTICLE ASIDE AUDIO B BASE BASEFONT BDI BDO BGSOUND
|
|
14
|
+
BIG BLINK BLOCKQUOTE BODY BR BUTTON CANVAS CAPTION CENTER CITE CODE COL COLGROUP COMMAND
|
|
15
|
+
CONTENT DATA DATALIST DD DEL DETAILS DFN DIALOG DIR DIV DL DT ELEMENT EM EMBED FIELDSET
|
|
16
|
+
FIGCAPTION FIGURE FONT FOOTER FORM FRAME FRAMESET H1 H2 H3 H4 H5 H6 HEAD HEADER HGROUP HR
|
|
17
|
+
HTML I IFRAME IMAGE IMG INPUT INS ISINDEX KBD KEYGEN LABEL LEGEND LI LINK LISTING MAIN
|
|
18
|
+
MAIN MAP MARK MARQUEE MENU MENUITEM META METER MULTICOL NAV NEXTID NOBR NOEMBED NOFRAMES
|
|
19
|
+
NOSCRIPT OBJECT OL OPTGROUP OPTION OUTPUT P PARAM PICTURE PLAINTEXT PRE PROGRESS Q RB RP
|
|
20
|
+
RT RTC RUBY S SAMP SCRIPT SECTION SELECT SHADOW SLOT SMALL SOURCE SPACER SPAN STRIKE
|
|
21
|
+
STRONG STYLE SUB SUMMARY SUP TABLE TBODY TD TEMPLATE TEXTAREA TFOOT TH THEAD TIME TITLE
|
|
22
|
+
TR TRACK TT U UL VAR VIDEO WBR XMP
|
|
23
|
+
]
|
|
24
|
+
end
|
|
25
|
+
# rubocop:enable Metrics/MethodLength
|
|
26
|
+
end
|
|
27
|
+
end
|
data/rspec-html.gemspec
CHANGED
|
@@ -6,7 +6,7 @@ require 'rspec/html/version'
|
|
|
6
6
|
|
|
7
7
|
Gem::Specification.new do |spec|
|
|
8
8
|
spec.name = 'rspec-html'
|
|
9
|
-
spec.version =
|
|
9
|
+
spec.version = RSpec::HTML::VERSION
|
|
10
10
|
spec.authors = ['Bob Farrell']
|
|
11
11
|
spec.email = ['git@bob.frl']
|
|
12
12
|
|
|
@@ -28,12 +28,16 @@ Gem::Specification.new do |spec|
|
|
|
28
28
|
spec.executables = []
|
|
29
29
|
spec.require_paths = ['lib']
|
|
30
30
|
|
|
31
|
+
spec.add_dependency 'nokogiri', '~> 1.10'
|
|
31
32
|
spec.add_dependency 'rspec', '~> 3.0'
|
|
32
33
|
|
|
33
34
|
spec.add_development_dependency 'bundler', '~> 2.0'
|
|
34
|
-
spec.add_development_dependency '
|
|
35
|
+
spec.add_development_dependency 'byebug', '~> 11.0'
|
|
36
|
+
spec.add_development_dependency 'devpack', '~> 0.1.2'
|
|
37
|
+
spec.add_development_dependency 'i18n', '~> 1.7'
|
|
38
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
|
35
39
|
spec.add_development_dependency 'rspec-its', '~> 1.3'
|
|
36
|
-
spec.add_development_dependency 'rubocop', '~> 0.
|
|
40
|
+
spec.add_development_dependency 'rubocop', '~> 0.88.0'
|
|
37
41
|
spec.add_development_dependency 'rubocop-rspec', '~> 1.36'
|
|
38
|
-
spec.add_development_dependency 'strong_versions', '~> 0.
|
|
42
|
+
spec.add_development_dependency 'strong_versions', '~> 0.4.5'
|
|
39
43
|
end
|
metadata
CHANGED
|
@@ -1,15 +1,29 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rspec-html
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1
|
|
4
|
+
version: 0.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Bob Farrell
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2020-07-30 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: nokogiri
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '1.10'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '1.10'
|
|
13
27
|
- !ruby/object:Gem::Dependency
|
|
14
28
|
name: rspec
|
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -38,20 +52,62 @@ dependencies:
|
|
|
38
52
|
- - "~>"
|
|
39
53
|
- !ruby/object:Gem::Version
|
|
40
54
|
version: '2.0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: byebug
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - "~>"
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '11.0'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - "~>"
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '11.0'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: devpack
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - "~>"
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: 0.1.2
|
|
76
|
+
type: :development
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - "~>"
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: 0.1.2
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: i18n
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - "~>"
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: '1.7'
|
|
90
|
+
type: :development
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - "~>"
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '1.7'
|
|
41
97
|
- !ruby/object:Gem::Dependency
|
|
42
98
|
name: rake
|
|
43
99
|
requirement: !ruby/object:Gem::Requirement
|
|
44
100
|
requirements:
|
|
45
101
|
- - "~>"
|
|
46
102
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: '
|
|
103
|
+
version: '13.0'
|
|
48
104
|
type: :development
|
|
49
105
|
prerelease: false
|
|
50
106
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
107
|
requirements:
|
|
52
108
|
- - "~>"
|
|
53
109
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: '
|
|
110
|
+
version: '13.0'
|
|
55
111
|
- !ruby/object:Gem::Dependency
|
|
56
112
|
name: rspec-its
|
|
57
113
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -72,14 +128,14 @@ dependencies:
|
|
|
72
128
|
requirements:
|
|
73
129
|
- - "~>"
|
|
74
130
|
- !ruby/object:Gem::Version
|
|
75
|
-
version: 0.
|
|
131
|
+
version: 0.88.0
|
|
76
132
|
type: :development
|
|
77
133
|
prerelease: false
|
|
78
134
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
135
|
requirements:
|
|
80
136
|
- - "~>"
|
|
81
137
|
- !ruby/object:Gem::Version
|
|
82
|
-
version: 0.
|
|
138
|
+
version: 0.88.0
|
|
83
139
|
- !ruby/object:Gem::Dependency
|
|
84
140
|
name: rubocop-rspec
|
|
85
141
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -100,14 +156,14 @@ dependencies:
|
|
|
100
156
|
requirements:
|
|
101
157
|
- - "~>"
|
|
102
158
|
- !ruby/object:Gem::Version
|
|
103
|
-
version: 0.
|
|
159
|
+
version: 0.4.5
|
|
104
160
|
type: :development
|
|
105
161
|
prerelease: false
|
|
106
162
|
version_requirements: !ruby/object:Gem::Requirement
|
|
107
163
|
requirements:
|
|
108
164
|
- - "~>"
|
|
109
165
|
- !ruby/object:Gem::Version
|
|
110
|
-
version: 0.
|
|
166
|
+
version: 0.4.5
|
|
111
167
|
description: HTML document abstraction and matchers for RSpec
|
|
112
168
|
email:
|
|
113
169
|
- git@bob.frl
|
|
@@ -117,6 +173,7 @@ extra_rdoc_files: []
|
|
|
117
173
|
files:
|
|
118
174
|
- ".gitignore"
|
|
119
175
|
- ".rspec"
|
|
176
|
+
- ".rubocop.yml"
|
|
120
177
|
- ".ruby-version"
|
|
121
178
|
- ".travis.yml"
|
|
122
179
|
- Gemfile
|
|
@@ -129,6 +186,11 @@ files:
|
|
|
129
186
|
- bin/setup
|
|
130
187
|
- lib/rspec/html.rb
|
|
131
188
|
- lib/rspec/html/version.rb
|
|
189
|
+
- lib/rspec_html.rb
|
|
190
|
+
- lib/rspec_html/element.rb
|
|
191
|
+
- lib/rspec_html/nameable.rb
|
|
192
|
+
- lib/rspec_html/searchable.rb
|
|
193
|
+
- lib/rspec_html/tags.rb
|
|
132
194
|
- rspec-html.gemspec
|
|
133
195
|
homepage: https://github.com/bobf/rspec-html
|
|
134
196
|
licenses:
|