rspec-html 0.3.2 → 0.3.3
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 +1 -1
- data/lib/rspec/html/version.rb +1 -1
- data/lib/rspec_html/search.rb +10 -4
- 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: d7fe3c7e19e3501479829d1b3999be456b05f0ac309c2400fe4b7aeafc379e2f
|
4
|
+
data.tar.gz: e4e7d1f167678a432a23b0e6a987027974ec048cf3da0e336d01b585f5127000
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8cb1be8484a9b0d230284a890e35149a06e361c2196c0b8e96b47a6e20eb1b112e543c943c0a205ba0f9f5fa5c72e97d82e281f63325c0b7db8c0fce3aa031b5
|
7
|
+
data.tar.gz: 9b6952bdfcf65162b3446c7ae7a9b6bdfc5dbe570b917acfed740f07dbc2ac60aafb5a4c0262bf1213e79230450ed49de32eff9ab2582fd498061520f67e7729
|
data/Gemfile.lock
CHANGED
data/lib/rspec/html/version.rb
CHANGED
data/lib/rspec_html/search.rb
CHANGED
@@ -56,11 +56,11 @@ module RSpecHTML
|
|
56
56
|
|
57
57
|
# rubocop:disable Naming/PredicateName
|
58
58
|
def has_css?(*args)
|
59
|
-
|
59
|
+
!blank?(@element&.css(*args))
|
60
60
|
end
|
61
61
|
|
62
62
|
def has_xpath?(*args)
|
63
|
-
|
63
|
+
!blank?(@element&.xpath(*args))
|
64
64
|
end
|
65
65
|
# rubocop:enable Naming/PredicateName
|
66
66
|
|
@@ -148,9 +148,9 @@ module RSpecHTML
|
|
148
148
|
end
|
149
149
|
|
150
150
|
def where_xpath(tag, query)
|
151
|
-
conditions = "[#{where_conditions(query)}]" unless query.compact
|
151
|
+
conditions = "[#{where_conditions(query)}]" unless blank?(query.compact)
|
152
152
|
result = @element&.xpath(".//#{tag}#{conditions}")
|
153
|
-
return result unless @siblings.is_a?(Nokogiri::XML::NodeSet) && (result
|
153
|
+
return result unless @siblings.is_a?(Nokogiri::XML::NodeSet) && blank?(result)
|
154
154
|
|
155
155
|
@siblings.xpath(".//#{tag}#{conditions}")
|
156
156
|
end
|
@@ -175,6 +175,12 @@ module RSpecHTML
|
|
175
175
|
|
176
176
|
@element&.css(tag.to_s)
|
177
177
|
end
|
178
|
+
|
179
|
+
def blank?(object)
|
180
|
+
return true unless object
|
181
|
+
|
182
|
+
object.empty?
|
183
|
+
end
|
178
184
|
end
|
179
185
|
# rubocop:enable Metrics/ClassLength
|
180
186
|
end
|
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.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bob Farrell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-05-
|
11
|
+
date: 2023-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|