capybara 2.14.0 → 2.14.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.md +12 -0
- data/README.md +1 -1
- data/lib/capybara.rb +16 -15
- data/lib/capybara/minitest.rb +92 -113
- data/lib/capybara/minitest/spec.rb +12 -37
- data/lib/capybara/node/matchers.rb +6 -5
- data/lib/capybara/queries/base_query.rb +4 -0
- data/lib/capybara/queries/current_path_query.rb +1 -0
- data/lib/capybara/queries/selector_query.rb +39 -12
- data/lib/capybara/queries/text_query.rb +1 -1
- data/lib/capybara/queries/title_query.rb +1 -0
- data/lib/capybara/rack_test/driver.rb +1 -0
- data/lib/capybara/rspec/matcher_proxies.rb +10 -6
- data/lib/capybara/rspec/matchers.rb +29 -0
- data/lib/capybara/selector.rb +61 -50
- data/lib/capybara/selector/expression_filter.rb +40 -0
- data/lib/capybara/selector/filter_set.rb +22 -3
- data/lib/capybara/selector/selector.rb +33 -12
- data/lib/capybara/selenium/driver.rb +130 -25
- data/lib/capybara/selenium/node.rb +3 -3
- data/lib/capybara/session/config.rb +29 -23
- data/lib/capybara/session/matchers.rb +3 -0
- data/lib/capybara/spec/session/accept_alert_spec.rb +1 -1
- data/lib/capybara/spec/session/all_spec.rb +2 -1
- data/lib/capybara/spec/session/assert_selector.rb +1 -1
- data/lib/capybara/spec/session/assert_title.rb +22 -9
- data/lib/capybara/spec/session/dismiss_confirm_spec.rb +3 -3
- data/lib/capybara/spec/session/dismiss_prompt_spec.rb +1 -1
- data/lib/capybara/spec/session/find_spec.rb +3 -2
- data/lib/capybara/spec/session/first_spec.rb +10 -5
- data/lib/capybara/spec/session/has_css_spec.rb +11 -0
- data/lib/capybara/spec/session/has_current_path_spec.rb +5 -3
- data/lib/capybara/spec/session/has_select_spec.rb +62 -4
- data/lib/capybara/spec/session/has_text_spec.rb +5 -3
- data/lib/capybara/spec/session/has_title_spec.rb +4 -2
- data/lib/capybara/spec/session/has_xpath_spec.rb +5 -3
- data/lib/capybara/spec/session/node_spec.rb +8 -4
- data/lib/capybara/spec/session/window/become_closed_spec.rb +4 -4
- data/lib/capybara/spec/session/window/window_opened_by_spec.rb +4 -4
- data/lib/capybara/spec/spec_helper.rb +1 -1
- data/lib/capybara/spec/views/form.erb +22 -1
- data/lib/capybara/spec/views/with_html.erb +1 -1
- data/lib/capybara/version.rb +1 -1
- data/spec/capybara_spec.rb +16 -0
- data/spec/filter_set_spec.rb +28 -0
- data/spec/minitest_spec_spec.rb +4 -4
- data/spec/per_session_config_spec.rb +4 -4
- data/spec/result_spec.rb +20 -0
- data/spec/selector_spec.rb +2 -1
- data/spec/selenium_spec_chrome.rb +12 -1
- data/spec/selenium_spec_firefox.rb +2 -1
- data/spec/selenium_spec_marionette.rb +4 -3
- data/spec/shared_selenium_session.rb +14 -7
- metadata +18 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f26eecbab15830d1234ded90963559b1bcc5a189
|
4
|
+
data.tar.gz: 1c53aa8f1da2909f235f41c778b48c0633749025
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d610898b0ab9dd9d8cdddc43de6e4933d041bc48bf38882865537986d5851e1ee24de44bbc172ea825a69dfe1ae4e98acc42269c0f86869cf54cc213da825b7
|
7
|
+
data.tar.gz: 6c7cc0c84a10b0b10f3990ab570cd065cdb329ec0ef3f55304d4fb6f66fa53e6e4498239e4c364fb80d9fedcf3c52bf5712f7d4131169c74e95b586c02c569f7
|
data/History.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
# Version 2.14.1
|
2
|
+
|
3
|
+
Release date: 2017-06-07
|
4
|
+
|
5
|
+
### Fixed
|
6
|
+
|
7
|
+
* Catch correct error when unexpected system modals are discovered in latest selenium [Thomas Walpole]
|
8
|
+
* Update default `puma` server registration to encourage it to run in single mode [Thomas Walpole]
|
9
|
+
* Suppress invalid element errors raised while lazily evaluating the results of `all` [Thomas Walpole]
|
10
|
+
* Added missing `with_selected` option to the :select selector to match `options`/`with_options` options - Issue #1865 [Bartosz Nowak]
|
11
|
+
* Workaround broken system modals when using selenium with headless Chrome
|
12
|
+
|
1
13
|
# Version 2.14.0
|
2
14
|
|
3
15
|
Release date: 2017-05-01
|
data/README.md
CHANGED
@@ -1071,7 +1071,7 @@ behaviors of Capybara change
|
|
1071
1071
|
my_session.config.default_max_wait_time = 10 # only set for my_session
|
1072
1072
|
Capybara.default_max_wait_time = 2 # will not change the default_max_wait in my_session
|
1073
1073
|
|
1074
|
-
* `current_driver` and `session_name` are thread specific. This means that `using_session
|
1074
|
+
* `current_driver` and `session_name` are thread specific. This means that `using_session` and
|
1075
1075
|
`using_driver` also only affect the current thread.
|
1076
1076
|
|
1077
1077
|
## <a name="development"></a>Development
|
data/lib/capybara.rb
CHANGED
@@ -27,32 +27,32 @@ module Capybara
|
|
27
27
|
|
28
28
|
# DelegateCapybara global configurations
|
29
29
|
# @!method app
|
30
|
-
# See {Capybara
|
30
|
+
# See {Capybara.configure}
|
31
31
|
# @!method reuse_server
|
32
|
-
# See {Capybara
|
32
|
+
# See {Capybara.configure}
|
33
33
|
# @!method threadsafe
|
34
|
-
# See {Capybara
|
34
|
+
# See {Capybara.configure}
|
35
35
|
# @!method server
|
36
|
-
# See {Capybara
|
36
|
+
# See {Capybara.configure}
|
37
37
|
# @!method default_driver
|
38
|
-
# See {Capybara
|
38
|
+
# See {Capybara.configure}
|
39
39
|
# @!method javascript_driver
|
40
|
-
# See {Capybara
|
40
|
+
# See {Capybara.configure}
|
41
41
|
Config::OPTIONS.each do |method|
|
42
42
|
def_delegators :config, method, "#{method}="
|
43
43
|
end
|
44
44
|
|
45
45
|
# Delegate Capybara global configurations
|
46
46
|
# @!method default_selector
|
47
|
-
# See {Capybara
|
47
|
+
# See {Capybara.configure}
|
48
48
|
# @!method default_max_wait_time
|
49
|
-
# See {Capybara
|
49
|
+
# See {Capybara.configure}
|
50
50
|
# @!method app_host
|
51
|
-
# See {Capybara
|
51
|
+
# See {Capybara.configure}
|
52
52
|
# @!method always_include_port
|
53
|
-
# See {Capybara
|
53
|
+
# See {Capybara.configure}
|
54
54
|
# @!method wait_on_first_by_default
|
55
|
-
# See {Capybara
|
55
|
+
# See {Capybara.configure}
|
56
56
|
SessionConfig::OPTIONS.each do |method|
|
57
57
|
def_delegators :config, method, "#{method}="
|
58
58
|
end
|
@@ -169,13 +169,14 @@ module Capybara
|
|
169
169
|
##
|
170
170
|
#
|
171
171
|
# Modify a selector previously created by {Capybara.add_selector}.
|
172
|
-
# For example
|
173
|
-
#
|
172
|
+
# For example, adding a new filter to the :button selector to filter based on
|
173
|
+
# button style (a class) might look like this
|
174
174
|
#
|
175
175
|
# Capybara.modify_selector(:button) do
|
176
|
-
#
|
176
|
+
# filter (:style, valid_values: [:primary, :secondary]) { |node, style| node[:class].split.include? "btn-#{style}" }
|
177
177
|
# end
|
178
178
|
#
|
179
|
+
#
|
179
180
|
# @param [Symbol] name The name of the selector to modify
|
180
181
|
# @yield A block executed in the context of the existing {Capybara::Selector}
|
181
182
|
#
|
@@ -447,7 +448,7 @@ end
|
|
447
448
|
|
448
449
|
Capybara.register_server :puma do |app, port, host|
|
449
450
|
require 'rack/handler/puma'
|
450
|
-
Rack::Handler::Puma.run(app, Host: host, Port: port, Threads: "0:4")
|
451
|
+
Rack::Handler::Puma.run(app, Host: host, Port: port, Threads: "0:4", workers: 0, daemon: false)
|
451
452
|
end
|
452
453
|
|
453
454
|
Capybara.configure do |config|
|
data/lib/capybara/minitest.rb
CHANGED
@@ -6,141 +6,140 @@ module Capybara
|
|
6
6
|
module Minitest
|
7
7
|
module Assertions
|
8
8
|
## Assert text exists
|
9
|
+
#
|
10
|
+
# @!method assert_text
|
9
11
|
# see {Capybara::Node::Matchers#assert_text}
|
10
|
-
def assert_text(*args)
|
11
|
-
self.assertions += 1
|
12
|
-
subject, *args = determine_subject(args)
|
13
|
-
subject.assert_text(*args)
|
14
|
-
rescue Capybara::ExpectationNotMet => e
|
15
|
-
raise ::Minitest::Assertion, e.message
|
16
|
-
end
|
17
|
-
alias_method :assert_content, :assert_text
|
18
12
|
|
19
13
|
## Assert text does not exist
|
14
|
+
#
|
15
|
+
# @!method assert_no_text
|
20
16
|
# see {Capybara::Node::Matchers#assert_no_text}
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
17
|
+
|
18
|
+
##
|
19
|
+
# Assertion that page title does match
|
20
|
+
#
|
21
|
+
# @!method assert_title
|
22
|
+
# see {Capybara::Node::DocumentMatchers#assert_title}
|
23
|
+
|
24
|
+
##
|
25
|
+
# Assertion that page title does not match
|
26
|
+
#
|
27
|
+
# @!method refute_title
|
28
|
+
# @!method assert_no_title
|
29
|
+
# see {Capybara::Node::DocumentMatchers#assert_no_title}
|
30
|
+
|
31
|
+
##
|
32
|
+
# Assertion that current path matches
|
33
|
+
#
|
34
|
+
# @!method assert_current_path
|
35
|
+
# see {Capybara::SessionMatchers#assert_current_path}
|
36
|
+
|
37
|
+
##
|
38
|
+
# Assertion that current page does not match
|
39
|
+
#
|
40
|
+
# @!method refute_current_path
|
41
|
+
# @!method assert_no_current_path
|
42
|
+
# see {Capybara::SessionMatchers#assert_no_current_path}
|
43
|
+
|
44
|
+
|
45
|
+
%w(assert_text assert_no_text assert_title assert_no_title assert_current_path assert_no_current_path).each do |assertion_name|
|
46
|
+
self.class_eval <<-EOM, __FILE__, __LINE__ + 1
|
47
|
+
def #{assertion_name} *args
|
48
|
+
self.assertions +=1
|
49
|
+
subject, *args = determine_subject(args)
|
50
|
+
subject.#{assertion_name}(*args)
|
51
|
+
rescue Capybara::ExpectationNotMet => e
|
52
|
+
raise ::Minitest::Assertions, e.message
|
53
|
+
end
|
54
|
+
EOM
|
27
55
|
end
|
56
|
+
|
57
|
+
alias_method :refute_title, :assert_no_title
|
28
58
|
alias_method :refute_text, :assert_no_text
|
29
59
|
alias_method :refute_content, :refute_text
|
60
|
+
alias_method :refute_current_path, :assert_no_current_path
|
61
|
+
alias_method :assert_content, :assert_text
|
30
62
|
alias_method :assert_no_content, :refute_text
|
31
63
|
|
32
64
|
## Assert selector exists on page
|
33
|
-
#
|
34
|
-
|
35
|
-
|
36
|
-
subject, *args = determine_subject(args)
|
37
|
-
subject.assert_selector(*args, &optional_filter_block)
|
38
|
-
rescue Capybara::ExpectationNotMet => e
|
39
|
-
raise ::Minitest::Assertion, e.message
|
40
|
-
end
|
65
|
+
#
|
66
|
+
# @!method assert_selector
|
67
|
+
# see {Capybara::Node::Matchers#assert_selector}
|
41
68
|
|
42
69
|
## Assert selector does not exist on page
|
43
|
-
#
|
44
|
-
|
45
|
-
|
46
|
-
subject, *args = determine_subject(args)
|
47
|
-
subject.assert_no_selector(*args, &optional_filter_block)
|
48
|
-
rescue Capybara::ExpectationNotMet => e
|
49
|
-
raise ::Minitest::Assertion, e.message
|
50
|
-
end
|
51
|
-
alias_method :refute_selector, :assert_no_selector
|
70
|
+
#
|
71
|
+
# @!method assert_no_selector
|
72
|
+
# see {Capybara::Node::Matchers#assert_no_selector}
|
52
73
|
|
53
74
|
## Assert element matches selector
|
54
|
-
#
|
55
|
-
|
56
|
-
|
57
|
-
subject, *args = determine_subject(args)
|
58
|
-
subject.assert_matches_selector(*args, &optional_filter_block)
|
59
|
-
rescue Capybara::ExpectationNotMet => e
|
60
|
-
raise ::Minitest::Assertion, e.message
|
61
|
-
end
|
75
|
+
#
|
76
|
+
# @!method assert_matches_selector
|
77
|
+
# see {Capybara::Node::Matchers#assert_matches_selector}
|
62
78
|
|
63
79
|
## Assert element does not match selector
|
64
|
-
#
|
65
|
-
|
66
|
-
|
67
|
-
subject, *args = determine_subject(args)
|
68
|
-
subject.assert_not_matches_selector(*args, &optional_filter_block)
|
69
|
-
rescue Capybara::ExpectationNotMet => e
|
70
|
-
raise ::Minitest::Assertion, e.message
|
71
|
-
end
|
72
|
-
alias_method :refute_matches_selector, :assert_not_matches_selector
|
73
|
-
|
74
|
-
%w(title current_path).each do |selector_type|
|
75
|
-
define_method "assert_#{selector_type}" do |*args|
|
76
|
-
begin
|
77
|
-
self.assertions += 1
|
78
|
-
subject, *args = determine_subject(args)
|
79
|
-
subject.public_send("assert_#{selector_type}",*args)
|
80
|
-
rescue Capybara::ExpectationNotMet => e
|
81
|
-
raise ::Minitest::Assertion, e.message
|
82
|
-
end
|
83
|
-
end
|
80
|
+
#
|
81
|
+
# @!method assert_xpath
|
82
|
+
# see {Capybara::Node::Matchers#assert_not_matches_selector}
|
84
83
|
|
85
|
-
|
86
|
-
|
87
|
-
|
84
|
+
%w(assert_selector assert_no_selector assert_matches_selector assert_not_matches_selector).each do |assertion_name|
|
85
|
+
self.class_eval <<-EOM, __FILE__, __LINE__ + 1
|
86
|
+
def #{assertion_name} *args, &optional_filter_block
|
87
|
+
self.assertions +=1
|
88
88
|
subject, *args = determine_subject(args)
|
89
|
-
subject
|
89
|
+
subject.#{assertion_name}(*args, &optional_filter_block)
|
90
90
|
rescue Capybara::ExpectationNotMet => e
|
91
|
-
raise ::Minitest::
|
91
|
+
raise ::Minitest::Assertions, e.message
|
92
92
|
end
|
93
|
-
|
94
|
-
alias_method "refute_#{selector_type}", "assert_no_#{selector_type}"
|
93
|
+
EOM
|
95
94
|
end
|
96
95
|
|
96
|
+
alias_method :refute_selector, :assert_no_selector
|
97
|
+
alias_method :refute_matches_selector, :assert_not_matches_selector
|
98
|
+
|
97
99
|
%w(xpath css link button field select table).each do |selector_type|
|
98
100
|
define_method "assert_#{selector_type}" do |*args, &optional_filter_block|
|
99
101
|
subject, *args = determine_subject(args)
|
100
|
-
locator, options =
|
101
|
-
locator, options = nil, locator if locator.is_a? Hash
|
102
|
+
locator, options = extract_locator(args)
|
102
103
|
assert_selector(subject, selector_type.to_sym, locator, options, &optional_filter_block)
|
103
104
|
end
|
104
105
|
|
105
106
|
define_method "assert_no_#{selector_type}" do |*args, &optional_filter_block|
|
106
107
|
subject, *args = determine_subject(args)
|
107
|
-
locator, options =
|
108
|
-
locator, options = nil, locator if locator.is_a? Hash
|
108
|
+
locator, options = extract_locator(args)
|
109
109
|
assert_no_selector(subject, selector_type.to_sym, locator, options, &optional_filter_block)
|
110
110
|
end
|
111
111
|
alias_method "refute_#{selector_type}", "assert_no_#{selector_type}"
|
112
112
|
end
|
113
113
|
|
114
|
-
%w(
|
115
|
-
define_method "
|
114
|
+
%w(checked unchecked).each do |field_type|
|
115
|
+
define_method "assert_#{field_type}_field" do |*args, &optional_filter_block|
|
116
116
|
subject, *args = determine_subject(args)
|
117
|
-
|
117
|
+
locator, options = extract_locator(args)
|
118
|
+
assert_selector(subject, :field, locator, options.merge(field_type.to_sym => true), &optional_filter_block)
|
118
119
|
end
|
119
120
|
|
120
|
-
define_method "
|
121
|
+
define_method "assert_no_#{field_type}_field" do |*args, &optional_filter_block|
|
121
122
|
subject, *args = determine_subject(args)
|
122
|
-
|
123
|
+
locator, options = extract_locator(args)
|
124
|
+
assert_no_selector(subject, :field, locator, options.merge(field_type.to_sym => true), &optional_filter_block)
|
123
125
|
end
|
124
|
-
alias_method "
|
126
|
+
alias_method "refute_#{field_type}_field", "assert_no_#{field_type}_field"
|
125
127
|
end
|
126
128
|
|
127
|
-
%w(
|
128
|
-
define_method "
|
129
|
+
%w(xpath css).each do |selector_type|
|
130
|
+
define_method "assert_matches_#{selector_type}" do |*args, &optional_filter_block|
|
129
131
|
subject, *args = determine_subject(args)
|
130
|
-
|
131
|
-
locator, options = nil, locator if locator.is_a? Hash
|
132
|
-
assert_selector(subject, :field, locator, options.merge(field_type.to_sym => true), &optional_filter_block)
|
132
|
+
assert_matches_selector(subject, selector_type.to_sym, *args, &optional_filter_block)
|
133
133
|
end
|
134
134
|
|
135
|
-
define_method "
|
135
|
+
define_method "assert_not_matches_#{selector_type}" do |*args, &optional_filter_block|
|
136
136
|
subject, *args = determine_subject(args)
|
137
|
-
|
138
|
-
locator, options = nil, locator if locator.is_a? Hash
|
139
|
-
assert_no_selector(subject, :field, locator, options.merge(field_type.to_sym => true), &optional_filter_block)
|
137
|
+
assert_not_matches_selector(subject, selector_type.to_sym, *args, &optional_filter_block)
|
140
138
|
end
|
141
|
-
alias_method "
|
139
|
+
alias_method "refute_matches_#{selector_type}", "assert_not_matches_#{selector_type}"
|
142
140
|
end
|
143
141
|
|
142
|
+
|
144
143
|
##
|
145
144
|
# Assertion that there is xpath
|
146
145
|
#
|
@@ -228,7 +227,7 @@ module Capybara
|
|
228
227
|
# Assertion that there is no unchecked_field
|
229
228
|
#
|
230
229
|
# @!method assert_no_unchecked_field
|
231
|
-
# @!method
|
230
|
+
# @!method refute_unchecked_field
|
232
231
|
|
233
232
|
##
|
234
233
|
# Assertion that there is select
|
@@ -256,32 +255,6 @@ module Capybara
|
|
256
255
|
# @!method assert_no_table
|
257
256
|
# see {Capybara::Node::Matchers#has_no_table?}
|
258
257
|
|
259
|
-
##
|
260
|
-
# Assertion that page title does match
|
261
|
-
#
|
262
|
-
# @!method assert_title
|
263
|
-
# see {Capybara::Node::DocumentMatchers#assert_title}
|
264
|
-
|
265
|
-
##
|
266
|
-
# Assertion that page title does not match
|
267
|
-
#
|
268
|
-
# @!method refute_title
|
269
|
-
# @!method assert_no_title
|
270
|
-
# see {Capybara::Node::DocumentMatchers#assert_no_title}
|
271
|
-
|
272
|
-
##
|
273
|
-
# Assertion that current path matches
|
274
|
-
#
|
275
|
-
# @!method assert_current_path
|
276
|
-
# see {Capybara::SessionMatchers#assert_current_path}
|
277
|
-
|
278
|
-
##
|
279
|
-
# Assertion that current page does not match
|
280
|
-
#
|
281
|
-
# @!method refute_current_path
|
282
|
-
# @!method assert_no_current_path
|
283
|
-
# see {Capybara::SessionMatchers#assert_no_current_path}
|
284
|
-
|
285
258
|
private
|
286
259
|
|
287
260
|
def determine_subject(args)
|
@@ -292,6 +265,12 @@ module Capybara
|
|
292
265
|
[page, *args]
|
293
266
|
end
|
294
267
|
end
|
268
|
+
|
269
|
+
def extract_locator(args)
|
270
|
+
locator, options = *args, {}
|
271
|
+
locator, options = nil, locator if locator.is_a? Hash
|
272
|
+
[locator, options]
|
273
|
+
end
|
295
274
|
end
|
296
275
|
end
|
297
276
|
end
|
@@ -8,47 +8,22 @@ module Capybara
|
|
8
8
|
infect_an_assertion "refute_#{assertion}", "wont_have_#{assertion}", :reverse
|
9
9
|
end
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
EOM
|
22
|
-
|
23
|
-
::Minitest::Expectation.class_eval <<-EOM, __FILE__, __LINE__ + 1
|
24
|
-
def must_have_#{assertion} *args, &optional_filter_block
|
25
|
-
ctx.assert_#{assertion}(target, *args, &optional_filter_block)
|
26
|
-
end
|
27
|
-
|
28
|
-
def wont_have_#{assertion} *args, &optional_filter_block
|
29
|
-
ctx.refute_#{assertion}(target, *args, &optional_filter_block)
|
30
|
-
end
|
31
|
-
EOM
|
32
|
-
end
|
33
|
-
|
34
|
-
%w(selector xpath css).each do |assertion|
|
35
|
-
self.class_eval <<-EOM
|
36
|
-
def must_match_#{assertion} *args, &optional_filter_block
|
37
|
-
::Minitest::Expectation.new(self, ::Minitest::Spec.current).must_match_#{assertion}(*args, &optional_filter_block)
|
38
|
-
end
|
39
|
-
|
40
|
-
def wont_match_#{assertion} *args, &optional_filter_block
|
41
|
-
::Minitest::Expectation.new(self, ::Minitest::Spec.current).wont_match_#{assertion}(*args, &optional_filter_block)
|
11
|
+
(%w(selector xpath css link button field select table checked_field unchecked_field).map do |assertion|
|
12
|
+
[["assert_#{assertion}", "must_have_#{assertion}"],
|
13
|
+
["refute_#{assertion}", "wont_have_#{assertion}"]]
|
14
|
+
end.flatten(1) + %w(selector xpath css).map do |assertion|
|
15
|
+
[["assert_matches_#{assertion}", "must_match_#{assertion}"],
|
16
|
+
["refute_matches_#{assertion}", "wont_match_#{assertion}"]]
|
17
|
+
end.flatten(1)).each do |(meth, new_name)|
|
18
|
+
self.class_eval <<-EOM, __FILE__, __LINE__ + 1
|
19
|
+
def #{new_name} *args, &block
|
20
|
+
::Minitest::Expectation.new(self, ::Minitest::Spec.current).#{new_name}(*args, &block)
|
42
21
|
end
|
43
22
|
EOM
|
44
23
|
|
45
24
|
::Minitest::Expectation.class_eval <<-EOM, __FILE__, __LINE__ + 1
|
46
|
-
def
|
47
|
-
ctx
|
48
|
-
end
|
49
|
-
|
50
|
-
def wont_match_#{assertion} *args, &optional_filter_block
|
51
|
-
ctx.refute_matches_#{assertion}(target, *args, &optional_filter_block)
|
25
|
+
def #{new_name} *args, &block
|
26
|
+
ctx.#{meth}(target, *args, &block)
|
52
27
|
end
|
53
28
|
EOM
|
54
29
|
end
|
@@ -432,11 +432,12 @@ module Capybara
|
|
432
432
|
#
|
433
433
|
# page.has_select?('Language', with_options: ['English', 'German'])
|
434
434
|
#
|
435
|
-
# @param [String] locator
|
436
|
-
# @option options [Array] :options
|
437
|
-
# @option options [Array] :with_options
|
438
|
-
# @option options [String, Array] :selected
|
439
|
-
# @
|
435
|
+
# @param [String] locator The label, name or id of a select box
|
436
|
+
# @option options [Array] :options Options which should be contained in this select box
|
437
|
+
# @option options [Array] :with_options Partial set of options which should be contained in this select box
|
438
|
+
# @option options [String, Array] :selected Options which should be selected
|
439
|
+
# @option options [String, Array] :with_selected Partial set of options which should minimally be selected
|
440
|
+
# @return [Boolean] Whether it exists
|
440
441
|
#
|
441
442
|
def has_select?(locator=nil, options={}, &optional_filter_block)
|
442
443
|
locator, options = nil, locator if locator.is_a? Hash
|