rspec-html 0.2.14 → 0.2.16
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/Gemfile.lock +36 -33
- data/README.md +7 -0
- data/lib/rspec/html/version.rb +1 -1
- data/lib/rspec_html/element.rb +2 -2
- data/lib/rspec_html/matchers/match_text.rb +1 -1
- data/lib/rspec_html/search.rb +12 -3
- data/lib/rspec_html.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f6a37320c65c9b804bc9e168b9b4db87c870fb41e65d8e87c01d63a706a4b22
|
4
|
+
data.tar.gz: 27235c7b257a78227b616222bbced4d2478a422a243d07a09bfa35eaeec81385
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4aada61bea34ef005d8d7703ea22946f006040814413a7bf4a1983bd7f1a058dbde51db12b3a46437e7ba27db65fe478f345db03cc6f7e6c29d91af2ffebff8c
|
7
|
+
data.tar.gz: 1bffb5835af37747cb144d82dae156f8e28b01af94312db10655f49208ee7e7ac6a9baede7656edd4c07ae667e0ba20c707cfa91c25dfcfb44716d5c52842017
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rspec-html (0.2.
|
4
|
+
rspec-html (0.2.16)
|
5
5
|
nokogiri (~> 1.10)
|
6
6
|
rspec (~> 3.0)
|
7
7
|
|
@@ -9,60 +9,63 @@ GEM
|
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
11
|
ast (2.4.2)
|
12
|
-
concurrent-ruby (1.
|
13
|
-
devpack (0.4.
|
12
|
+
concurrent-ruby (1.2.2)
|
13
|
+
devpack (0.4.1)
|
14
14
|
diff-lcs (1.5.0)
|
15
|
-
i18n (1.
|
15
|
+
i18n (1.13.0)
|
16
16
|
concurrent-ruby (~> 1.0)
|
17
|
-
|
18
|
-
nokogiri (1.13.
|
19
|
-
mini_portile2 (~> 2.8.0)
|
17
|
+
json (2.6.3)
|
18
|
+
nokogiri (1.13.10-x86_64-linux)
|
20
19
|
racc (~> 1.4)
|
21
|
-
paint (2.
|
22
|
-
parallel (1.
|
23
|
-
parser (3.
|
20
|
+
paint (2.3.0)
|
21
|
+
parallel (1.23.0)
|
22
|
+
parser (3.2.2.1)
|
24
23
|
ast (~> 2.4.1)
|
25
|
-
racc (1.6.
|
24
|
+
racc (1.6.2)
|
26
25
|
rainbow (3.1.1)
|
27
26
|
rake (13.0.6)
|
28
|
-
regexp_parser (2.
|
27
|
+
regexp_parser (2.8.0)
|
29
28
|
rexml (3.2.5)
|
30
|
-
rspec (3.
|
31
|
-
rspec-core (~> 3.
|
32
|
-
rspec-expectations (~> 3.
|
33
|
-
rspec-mocks (~> 3.
|
34
|
-
rspec-core (3.
|
35
|
-
rspec-support (~> 3.
|
36
|
-
rspec-expectations (3.
|
29
|
+
rspec (3.12.0)
|
30
|
+
rspec-core (~> 3.12.0)
|
31
|
+
rspec-expectations (~> 3.12.0)
|
32
|
+
rspec-mocks (~> 3.12.0)
|
33
|
+
rspec-core (3.12.2)
|
34
|
+
rspec-support (~> 3.12.0)
|
35
|
+
rspec-expectations (3.12.3)
|
37
36
|
diff-lcs (>= 1.2.0, < 2.0)
|
38
|
-
rspec-support (~> 3.
|
37
|
+
rspec-support (~> 3.12.0)
|
39
38
|
rspec-its (1.3.0)
|
40
39
|
rspec-core (>= 3.0.0)
|
41
40
|
rspec-expectations (>= 3.0.0)
|
42
|
-
rspec-mocks (3.
|
41
|
+
rspec-mocks (3.12.5)
|
43
42
|
diff-lcs (>= 1.2.0, < 2.0)
|
44
|
-
rspec-support (~> 3.
|
45
|
-
rspec-support (3.
|
46
|
-
rubocop (1.
|
43
|
+
rspec-support (~> 3.12.0)
|
44
|
+
rspec-support (3.12.0)
|
45
|
+
rubocop (1.50.2)
|
46
|
+
json (~> 2.3)
|
47
47
|
parallel (~> 1.10)
|
48
|
-
parser (>= 3.
|
48
|
+
parser (>= 3.2.0.0)
|
49
49
|
rainbow (>= 2.2.2, < 4.0)
|
50
50
|
regexp_parser (>= 1.8, < 3.0)
|
51
51
|
rexml (>= 3.2.5, < 4.0)
|
52
|
-
rubocop-ast (>= 1.
|
52
|
+
rubocop-ast (>= 1.28.0, < 2.0)
|
53
53
|
ruby-progressbar (~> 1.7)
|
54
|
-
unicode-display_width (>=
|
55
|
-
rubocop-ast (1.
|
56
|
-
parser (>= 3.
|
54
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
55
|
+
rubocop-ast (1.28.0)
|
56
|
+
parser (>= 3.2.1.0)
|
57
|
+
rubocop-capybara (2.18.0)
|
58
|
+
rubocop (~> 1.41)
|
57
59
|
rubocop-rake (0.6.0)
|
58
60
|
rubocop (~> 1.0)
|
59
|
-
rubocop-rspec (2.
|
60
|
-
rubocop (~> 1.
|
61
|
-
|
61
|
+
rubocop-rspec (2.20.0)
|
62
|
+
rubocop (~> 1.33)
|
63
|
+
rubocop-capybara (~> 2.17)
|
64
|
+
ruby-progressbar (1.13.0)
|
62
65
|
strong_versions (0.4.5)
|
63
66
|
i18n (>= 0.5)
|
64
67
|
paint (~> 2.0)
|
65
|
-
unicode-display_width (2.
|
68
|
+
unicode-display_width (2.4.2)
|
66
69
|
|
67
70
|
PLATFORMS
|
68
71
|
ruby
|
data/README.md
CHANGED
@@ -130,6 +130,13 @@ expect(document.body).to have_css 'html body div.myclass'
|
|
130
130
|
expect(document.body).to have_xpath '//html/body/div[@class="myclass"]'
|
131
131
|
```
|
132
132
|
|
133
|
+
#### Checkboxes
|
134
|
+
|
135
|
+
Use `be_checked` to test if a checkbox is checked:
|
136
|
+
```ruby
|
137
|
+
expect(document.input(type: 'checkbox')).to be_checked
|
138
|
+
```
|
139
|
+
|
133
140
|
### Custom Matchers
|
134
141
|
<a name="matchers"></a>
|
135
142
|
|
data/lib/rspec/html/version.rb
CHANGED
data/lib/rspec_html/element.rb
CHANGED
@@ -11,14 +11,14 @@ module RSpecHTML
|
|
11
11
|
:has_css?, :has_xpath?, :include?,
|
12
12
|
:siblings, :text, :truncated_text, :attributes,
|
13
13
|
:size, :length, :[],
|
14
|
-
:css, :xpath
|
14
|
+
:css, :xpath, :checked?
|
15
15
|
|
16
16
|
def initialize(element, name, options: {}, siblings: [])
|
17
17
|
@name = name
|
18
18
|
@element = element
|
19
19
|
@options = options
|
20
20
|
@siblings = siblings || []
|
21
|
-
@search = Search.new(@element, @siblings)
|
21
|
+
@search = Search.new(@element, @siblings, self)
|
22
22
|
end
|
23
23
|
|
24
24
|
def present?
|
data/lib/rspec_html/search.rb
CHANGED
@@ -6,9 +6,10 @@ module RSpecHTML
|
|
6
6
|
class Search
|
7
7
|
attr_reader :siblings
|
8
8
|
|
9
|
-
def initialize(element, siblings)
|
9
|
+
def initialize(element, siblings, element_wrapper)
|
10
10
|
@element = element
|
11
11
|
@siblings = siblings
|
12
|
+
@element_wrapper = element_wrapper
|
12
13
|
end
|
13
14
|
|
14
15
|
def to_s
|
@@ -32,6 +33,12 @@ module RSpecHTML
|
|
32
33
|
end
|
33
34
|
alias exist? present?
|
34
35
|
|
36
|
+
def checked?
|
37
|
+
raise ElementNotFoundError, "Element does not exist: #{element_wrapper.reconstituted}" if @element.nil?
|
38
|
+
|
39
|
+
@element.attributes.key?('checked')
|
40
|
+
end
|
41
|
+
|
35
42
|
# rubocop:disable Naming/PredicateName
|
36
43
|
def has_css?(*args)
|
37
44
|
!@element&.css(*args)&.empty?
|
@@ -91,14 +98,16 @@ module RSpecHTML
|
|
91
98
|
|
92
99
|
private
|
93
100
|
|
101
|
+
attr_reader :element_wrapper
|
102
|
+
|
94
103
|
def index(val)
|
95
104
|
zero_index_error if val.zero?
|
96
|
-
self.class.new(@siblings[val - 1], @element.name)
|
105
|
+
self.class.new(@siblings[val - 1], @element.name, element_wrapper)
|
97
106
|
end
|
98
107
|
|
99
108
|
def range(val)
|
100
109
|
zero_index_error if val.first.zero?
|
101
|
-
self.class.new(@siblings[(val.first - 1)..(val.last - 1)], :range)
|
110
|
+
self.class.new(@siblings[(val.first - 1)..(val.last - 1)], :range, element_wrapper)
|
102
111
|
end
|
103
112
|
|
104
113
|
def zero_index_error
|
data/lib/rspec_html.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-html
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.16
|
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: 2023-05-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|