rspec-html 0.3.1 → 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: e4eb7179d1b8e0ae007c863c0ff33ee3b7599e5f9d8d105fc5be06afd273f7a8
4
- data.tar.gz: 391b0849d222beac92d0e98975da2f0eaf66d5bc1fce3285ba26d9ad36007250
3
+ metadata.gz: d7fe3c7e19e3501479829d1b3999be456b05f0ac309c2400fe4b7aeafc379e2f
4
+ data.tar.gz: e4e7d1f167678a432a23b0e6a987027974ec048cf3da0e336d01b585f5127000
5
5
  SHA512:
6
- metadata.gz: 37f3419b01b9d60979a51e7f3866e2a3b42b87b1988141fe5819de6a76f387c844ebd1f79f44aecdf7e675d13c89fb92681fd21fbf63d78e02737e03ae9b2827
7
- data.tar.gz: '08ffe7d4519cda519b2dc02bb9fcc3321fdf92ab76480c1a4f0d82b9c9e922aae8103d121b2f3c7649e9926484c9d27030e646d689763db1dc8385ed24abc706'
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.1)
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.1'
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.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.1
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-14 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