capybara 3.0.1 → 3.0.2
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/History.md +8 -0
- data/lib/capybara/rspec/matchers.rb +5 -0
- data/lib/capybara/selector/selector.rb +1 -1
- data/lib/capybara/version.rb +1 -1
- data/spec/rspec/shared_spec_matchers.rb +7 -0
- data/spec/selector_spec.rb +15 -0
- 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: 78eeeb205ad6e29addf7c2729e180b39076becacfee989561cea4c9e29f6bd65
|
4
|
+
data.tar.gz: 9adb328acd7184ee33e156ec4b842ca048aa792ddda95e9396a515778a04b82d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89ba8bfe2b60b8dc5dd3234c6f1bff37576d93432d64e13478dde82b94d6e2e6d46ec7e4c28791744382c578223edfc242c27f34695e2a078a7637465fc01833
|
7
|
+
data.tar.gz: e8334635068aef37f9ca3a2bd66b9de9fa2b467391dfd9ffa1d72df333cbbeb1adb5ac120471d162286ed14ccf85af160a3421c700ce98ee7f9e3bfb2edc4377
|
data/History.md
CHANGED
@@ -199,6 +199,11 @@ module Capybara
|
|
199
199
|
end
|
200
200
|
|
201
201
|
class NegatedMatcher
|
202
|
+
if defined?(::RSpec::Expectations::Version)
|
203
|
+
require 'capybara/rspec/compound'
|
204
|
+
include ::Capybara::RSpecMatchers::Compound
|
205
|
+
end
|
206
|
+
|
202
207
|
def initialize(matcher)
|
203
208
|
@matcher = matcher
|
204
209
|
end
|
@@ -251,7 +251,7 @@ module Capybara
|
|
251
251
|
end
|
252
252
|
|
253
253
|
def describe_all_expression_filters(**opts)
|
254
|
-
expression_filters.map { |ef| " with #{ef} #{opts[ef]}" if opts.key?(ef) }.join
|
254
|
+
expression_filters.keys.map { |ef| " with #{ef} #{opts[ef]}" if opts.key?(ef) }.join
|
255
255
|
end
|
256
256
|
|
257
257
|
def find_by_attr(attribute, value)
|
data/lib/capybara/version.rb
CHANGED
@@ -80,6 +80,8 @@ RSpec.shared_examples Capybara::RSpecMatchers do |session, _mode|
|
|
80
80
|
it "supports compounding" do
|
81
81
|
expect("<h1>Text</h1><h2>Text</h2>").to have_css('h1').and have_css('h2')
|
82
82
|
expect("<h1>Text</h1><h2>Text</h2>").to have_css('h3').or have_css('h1')
|
83
|
+
expect("<h1>Text</h1><h2>Text</h2>").to have_no_css('h4').and have_css('h2')
|
84
|
+
expect("<h1>Text</h1><h2>Text</h2>").to have_no_css('h2').or have_css('h1')
|
83
85
|
end
|
84
86
|
end
|
85
87
|
|
@@ -147,6 +149,8 @@ RSpec.shared_examples Capybara::RSpecMatchers do |session, _mode|
|
|
147
149
|
it "supports compounding" do
|
148
150
|
expect("<h1>Text</h1><h2>Text</h2>").to have_xpath('//h1').and have_xpath('//h2')
|
149
151
|
expect("<h1>Text</h1><h2>Text</h2>").to have_xpath('//h3').or have_xpath('//h1')
|
152
|
+
expect("<h1>Text</h1><h2>Text</h2>").to have_no_xpath('//h4').and have_xpath('//h1')
|
153
|
+
expect("<h1>Text</h1><h2>Text</h2>").to have_no_xpath('//h4').or have_xpath('//h4')
|
150
154
|
end
|
151
155
|
end
|
152
156
|
|
@@ -253,6 +257,7 @@ RSpec.shared_examples Capybara::RSpecMatchers do |session, _mode|
|
|
253
257
|
it "supports compounding" do
|
254
258
|
expect("<h1>Text</h1><h2>Text</h2>").to have_selector('//h1').and have_selector('//h2')
|
255
259
|
expect("<h1>Text</h1><h2>Text</h2>").to have_selector('//h3').or have_selector('//h1')
|
260
|
+
expect("<h1>Text</h1><h2>Text</h2>").to have_no_selector('//h3').and have_selector('//h1')
|
256
261
|
end
|
257
262
|
end
|
258
263
|
|
@@ -342,6 +347,7 @@ RSpec.shared_examples Capybara::RSpecMatchers do |session, _mode|
|
|
342
347
|
it "supports compounding" do
|
343
348
|
expect("<h1>Text</h1><h2>And</h2>").to have_content('Text').and have_content('And')
|
344
349
|
expect("<h1>Text</h1><h2>Or</h2>").to have_content('XYZ').or have_content('Or')
|
350
|
+
expect("<h1>Text</h1><h2>Or</h2>").to have_no_content('XYZ').and have_content('Or')
|
345
351
|
end
|
346
352
|
end
|
347
353
|
|
@@ -499,6 +505,7 @@ RSpec.shared_examples Capybara::RSpecMatchers do |session, _mode|
|
|
499
505
|
it "supports compounding" do
|
500
506
|
expect(html).to have_link('Just a link').and have_link('Another link')
|
501
507
|
expect(html).to have_link('Not a link').or have_link('Another link')
|
508
|
+
expect(html).to have_no_link('Not a link').and have_link('Another link')
|
502
509
|
end
|
503
510
|
end
|
504
511
|
|
data/spec/selector_spec.rb
CHANGED
@@ -27,6 +27,7 @@ RSpec.describe Capybara do
|
|
27
27
|
<input type="text" name="form[my_text_input]" placeholder="my text" id="my_text_input"/>
|
28
28
|
<input type="file" id="file" class=".special file"/>
|
29
29
|
<input type="hidden" id="hidden_field" value="this is hidden"/>
|
30
|
+
<input type="submit" value="click me" title="submit button"/>
|
30
31
|
<a href="#">link</a>
|
31
32
|
<fieldset></fieldset>
|
32
33
|
<select id="select">
|
@@ -193,6 +194,20 @@ RSpec.describe Capybara do
|
|
193
194
|
expect(string.find(:option, disabled: false, selected: false).value).to eq 'a'
|
194
195
|
end
|
195
196
|
end
|
197
|
+
|
198
|
+
describe ":button selector" do
|
199
|
+
it "finds by value" do
|
200
|
+
expect(string.find(:button, 'click me').value).to eq 'click me'
|
201
|
+
end
|
202
|
+
|
203
|
+
it "finds by title" do
|
204
|
+
expect(string.find(:button, 'submit button').value).to eq 'click me'
|
205
|
+
end
|
206
|
+
|
207
|
+
it "includes non-matching parameters in failure message" do
|
208
|
+
expect { string.find(:button, 'click me', title: 'click me') }.to raise_error(/with title click me/)
|
209
|
+
end
|
210
|
+
end
|
196
211
|
end
|
197
212
|
end
|
198
213
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capybara
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Walpole
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain:
|
12
12
|
- gem-public_cert.pem
|
13
|
-
date: 2018-04-
|
13
|
+
date: 2018-04-13 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: addressable
|