rspec-html 0.2.5 → 0.2.6

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: a5241cc27dba3e36c05cd7595280908be306d659d6611e02b70d58984a2f8900
4
- data.tar.gz: 18e5487083e27fe812565b15c0411026ba622cb82c0bbbeb36787167928dab48
3
+ metadata.gz: 0b613fed0b8e19c8069435ab30d735afa9660c66bb7beb6ee226aede70014f0e
4
+ data.tar.gz: c3526928723a917ed6511d3e17e6627df79090d342203e78fa64ab84e174a309
5
5
  SHA512:
6
- metadata.gz: 39065b13e1a1d959fcebecc3004b20e2940b560c06a9789d39b1ffa99c249f4cb0062c3888ed6af69e44d2523ff8ed4ea66989c4e35e3e924764610c51900414
7
- data.tar.gz: 4c275980c39e8f9506a03cbb8ceca6bfdf16304aaa37f4eba318ae0e085106cfc5502f34148d4d6dfe86d7a000d145e39015ab20471ee812447f16d7b09d60b3
6
+ metadata.gz: f3e0dfbd5105659467f468131d7ea32baaf94e406af8dbef7e521ff762572479ad0394ee69474e1fc2f510e493d62d5981cb32b9756665b63af9c7d12220750d
7
+ data.tar.gz: 8cbc3b3579dee20f89d55de6b6e8221f1a32e73b67e3b875a18b8b604d579a12e46d835d63cc14c0c4453022a888f3b44b92d2c7ab97c08299945eb7538382cd
data/README.md CHANGED
@@ -7,7 +7,7 @@ _RSpec::HTML_ provides a simple object interface to HTML responses from [_RSpec
7
7
  Add the gem to your `Gemfile`:
8
8
 
9
9
  ```ruby
10
- gem 'rspec-html', '~> 0.2.5'
10
+ gem 'rspec-html', '~> 0.2.6'
11
11
  ```
12
12
 
13
13
  And rebuild your bundle:
@@ -11,11 +11,9 @@ module RSpec
11
11
  def document
12
12
  return @document if @document
13
13
 
14
- if !defined?(response) || response.nil?
15
- raise RSpecHTML::NoResponseError, 'No `response` object found. Make a request first.'
16
- end
17
-
18
14
  RSpecHTML::Element.new(Nokogiri::HTML.parse(response.body), :document)
15
+ rescue NameError
16
+ raise RSpecHTML::NoResponseError, 'No `response` object found. Make a request first.'
19
17
  end
20
18
 
21
19
  def parse_html(content)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RSpec
4
4
  module HTML
5
- VERSION = '0.2.5'
5
+ VERSION = '0.2.6'
6
6
  end
7
7
  end
@@ -100,6 +100,7 @@ module RSpecHTML
100
100
  else
101
101
  where_xpath(tag, query)
102
102
  end
103
+ return nil unless matched || all
103
104
  return matched&.first unless all
104
105
 
105
106
  matched
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.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bob Farrell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-01 00:00:00.000000000 Z
11
+ date: 2020-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri