rspec-html 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 654cc8f392f2bde8068c50baedce33357749605760fe00d46558d6aef072a21f
4
- data.tar.gz: 7d207122c82ceb3681ab65cd00c05871c73fbe2628855943fa6c6758ab957451
3
+ metadata.gz: d7fe3c7e19e3501479829d1b3999be456b05f0ac309c2400fe4b7aeafc379e2f
4
+ data.tar.gz: e4e7d1f167678a432a23b0e6a987027974ec048cf3da0e336d01b585f5127000
5
5
  SHA512:
6
- metadata.gz: a1295ec0d0106dcfc7dc4157be1a56527137b2c671d814e1a62226a062a8e83844bf2571cbd42a90e2317033b4f39a8b4c433b2733ae3e186aed9ce6af1d6e7e
7
- data.tar.gz: 8e5b3027c778ccbbf5ddc46b3b915ee87de9b3e0cbdbd022c196b6a81e4cb2912faccf8eebaab6b76e4ce517d3c957e91a79bb5f2c28c7f2a20193e5e0e1dd8c
6
+ metadata.gz: 8cb1be8484a9b0d230284a890e35149a06e361c2196c0b8e96b47a6e20eb1b112e543c943c0a205ba0f9f5fa5c72e97d82e281f63325c0b7db8c0fce3aa031b5
7
+ data.tar.gz: 9b6952bdfcf65162b3446c7ae7a9b6bdfc5dbe570b917acfed740f07dbc2ac60aafb5a4c0262bf1213e79230450ed49de32eff9ab2582fd498061520f67e7729
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rspec-html (0.3.2)
4
+ rspec-html (0.3.3)
5
5
  nokogiri (~> 1.10)
6
6
  rspec (~> 3.0)
7
7
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RSpec
4
4
  module HTML
5
- VERSION = '0.3.2'
5
+ VERSION = '0.3.3'
6
6
  end
7
7
  end
@@ -56,11 +56,11 @@ module RSpecHTML
56
56
 
57
57
  # rubocop:disable Naming/PredicateName
58
58
  def has_css?(*args)
59
- !@element&.css(*args)&.empty?
59
+ !blank?(@element&.css(*args))
60
60
  end
61
61
 
62
62
  def has_xpath?(*args)
63
- !@element&.xpath(*args)&.empty?
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.empty?
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.nil? || result.empty?)
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.2
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-18 00:00:00.000000000 Z
11
+ date: 2023-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri