rspec-html 0.1.1 → 0.1.2

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: 8b6fbffdbd1506e148ae25b7900d508e3f50048cb3c2d27ed25ef2fd5a93d0ab
4
- data.tar.gz: 8868853f56675ca2d4487b155a8da72c668ed6f80ebf61885f718a653d3b58a5
3
+ metadata.gz: 413a58c112d2fbb3af070285d637a63c860b6bcb66c4a4370f253c387d600cf5
4
+ data.tar.gz: ecef355b3d1e0c766b76c2107298fdff7eca6b508b80fefecc2b01847ebb8f1f
5
5
  SHA512:
6
- metadata.gz: 63b9fa7b4043a45485bb6423c26ab1812e8ab56283285ad6f3e92402fe4f47c5a20e5f62b1102816f5a24a25c04965310464e69eacfc0619e7500cf716bde298
7
- data.tar.gz: 1065cfee90afa2c3372c524abf7e6a7383c56f6e349d35f1f9bbe06b6e803665459c41f7360d9066baeccd5375d4a666cddd64f4921be85dd5b25faa668453dd
6
+ metadata.gz: c142dad521ba1f3b5ef4b789954d64eb0ae8b8a58ad437f3c73bf3341f167593eb0b7ea1a14b46c83994d536ece5f44a1a10f18c01e8d01f9822ec86cc7e3737
7
+ data.tar.gz: 1d83c8fb486c4bc71da176760f29e9ed631fd9e02ac26531e40114ed4169ad4e556a42c6d0cbd2f2bbc4933b49b63897c3f8248a7078d8d485aff0ed3e704018
@@ -0,0 +1,4 @@
1
+ Metrics/BlockLength:
2
+ Exclude:
3
+ - 'spec/**/*'
4
+ - 'rspec-html.gemspec'
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rspec-html (0.1.0)
4
+ rspec-html (0.1.2)
5
5
  nokogiri (~> 1.10)
6
6
  rspec (~> 3.0)
7
7
 
@@ -18,7 +18,7 @@ GEM
18
18
  concurrent-ruby (~> 1.0)
19
19
  jaro_winkler (1.5.4)
20
20
  mini_portile2 (2.4.0)
21
- nokogiri (1.10.5)
21
+ nokogiri (1.10.9)
22
22
  mini_portile2 (~> 2.4.0)
23
23
  paint (2.1.1)
24
24
  parallel (1.19.1)
@@ -38,7 +38,7 @@ GEM
38
38
  rspec-its (1.3.0)
39
39
  rspec-core (>= 3.0.0)
40
40
  rspec-expectations (>= 3.0.0)
41
- rspec-mocks (3.9.0)
41
+ rspec-mocks (3.9.1)
42
42
  diff-lcs (>= 1.2.0, < 2.0)
43
43
  rspec-support (~> 3.9.0)
44
44
  rspec-support (3.9.0)
data/README.md CHANGED
@@ -5,7 +5,7 @@ _RSpec::HTML_ provides a simple object interface to HTML responses from [_RSpec
5
5
  ## Installation
6
6
 
7
7
  ```ruby
8
- gem 'rspec-html', '~> 0.1.1'
8
+ gem 'rspec-html', '~> 0.1.2'
9
9
  ```
10
10
 
11
11
  Bundle
@@ -33,6 +33,8 @@ RSpec.describe 'something', type: :request do
33
33
  it 'does something' do
34
34
  get '/'
35
35
  expect(document.body).to include 'something'
36
+ expect(document.body).to have_css 'html body div.myclass'
37
+ expect(document.body).to have_xpath '//html/body/div[@class="myclass"]'
36
38
  end
37
39
  end
38
40
  ```
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RSpec
4
4
  module HTML
5
- VERSION = '0.1.1'
5
+ VERSION = '0.1.2'
6
6
  end
7
7
  end
@@ -7,6 +7,16 @@ module RSpecHTML
7
7
  @html = html
8
8
  end
9
9
 
10
+ # rubocop:disable Naming/PredicateName
11
+ def has_xpath?(*args)
12
+ !parsed_html.xpath(*args).empty?
13
+ end
14
+
15
+ def has_css?(*args)
16
+ !parsed_html.css(*args).empty?
17
+ end
18
+ # rubocop:enable Naming/PredicateName
19
+
10
20
  def body
11
21
  Body.new(parsed_html)
12
22
  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.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bob Farrell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-21 00:00:00.000000000 Z
11
+ date: 2020-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -173,6 +173,7 @@ extra_rdoc_files: []
173
173
  files:
174
174
  - ".gitignore"
175
175
  - ".rspec"
176
+ - ".rubocop.yml"
176
177
  - ".ruby-version"
177
178
  - ".travis.yml"
178
179
  - Gemfile