capybara 3.26.0 → 3.31.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/History.md +86 -0
  3. data/README.md +2 -3
  4. data/lib/capybara/config.rb +7 -3
  5. data/lib/capybara/driver/node.rb +4 -0
  6. data/lib/capybara/dsl.rb +10 -2
  7. data/lib/capybara/helpers.rb +3 -1
  8. data/lib/capybara/minitest.rb +47 -33
  9. data/lib/capybara/node/actions.rb +24 -19
  10. data/lib/capybara/node/document.rb +2 -2
  11. data/lib/capybara/node/document_matchers.rb +3 -3
  12. data/lib/capybara/node/element.rb +54 -17
  13. data/lib/capybara/node/finders.rb +17 -11
  14. data/lib/capybara/node/matchers.rb +66 -51
  15. data/lib/capybara/node/simple.rb +6 -3
  16. data/lib/capybara/queries/ancestor_query.rb +5 -9
  17. data/lib/capybara/queries/base_query.rb +2 -1
  18. data/lib/capybara/queries/selector_query.rb +220 -6
  19. data/lib/capybara/queries/sibling_query.rb +4 -10
  20. data/lib/capybara/rack_test/browser.rb +4 -1
  21. data/lib/capybara/rack_test/driver.rb +1 -1
  22. data/lib/capybara/rack_test/form.rb +1 -1
  23. data/lib/capybara/rack_test/node.rb +38 -3
  24. data/lib/capybara/registrations/patches/puma_ssl.rb +27 -0
  25. data/lib/capybara/registrations/servers.rb +7 -1
  26. data/lib/capybara/result.rb +29 -9
  27. data/lib/capybara/rspec/matchers.rb +27 -27
  28. data/lib/capybara/rspec/matchers/base.rb +14 -6
  29. data/lib/capybara/rspec/matchers/count_sugar.rb +2 -1
  30. data/lib/capybara/rspec/matchers/have_ancestor.rb +4 -3
  31. data/lib/capybara/rspec/matchers/have_current_path.rb +2 -2
  32. data/lib/capybara/rspec/matchers/have_selector.rb +15 -7
  33. data/lib/capybara/rspec/matchers/have_sibling.rb +3 -3
  34. data/lib/capybara/rspec/matchers/have_text.rb +2 -2
  35. data/lib/capybara/rspec/matchers/have_title.rb +2 -2
  36. data/lib/capybara/rspec/matchers/match_selector.rb +3 -3
  37. data/lib/capybara/rspec/matchers/match_style.rb +2 -2
  38. data/lib/capybara/rspec/matchers/spatial_sugar.rb +39 -0
  39. data/lib/capybara/selector.rb +35 -17
  40. data/lib/capybara/selector/css.rb +1 -1
  41. data/lib/capybara/selector/definition.rb +2 -2
  42. data/lib/capybara/selector/definition/button.rb +7 -2
  43. data/lib/capybara/selector/definition/checkbox.rb +2 -2
  44. data/lib/capybara/selector/definition/css.rb +3 -1
  45. data/lib/capybara/selector/definition/datalist_input.rb +1 -1
  46. data/lib/capybara/selector/definition/datalist_option.rb +1 -1
  47. data/lib/capybara/selector/definition/element.rb +1 -1
  48. data/lib/capybara/selector/definition/field.rb +1 -1
  49. data/lib/capybara/selector/definition/file_field.rb +1 -1
  50. data/lib/capybara/selector/definition/fillable_field.rb +2 -2
  51. data/lib/capybara/selector/definition/label.rb +4 -2
  52. data/lib/capybara/selector/definition/radio_button.rb +2 -2
  53. data/lib/capybara/selector/definition/select.rb +32 -13
  54. data/lib/capybara/selector/definition/table.rb +5 -2
  55. data/lib/capybara/selector/filter_set.rb +11 -9
  56. data/lib/capybara/selector/filters/base.rb +6 -1
  57. data/lib/capybara/selector/filters/locator_filter.rb +1 -1
  58. data/lib/capybara/selector/regexp_disassembler.rb +7 -0
  59. data/lib/capybara/selector/selector.rb +4 -2
  60. data/lib/capybara/selenium/atoms/isDisplayed.min.js +1 -1
  61. data/lib/capybara/selenium/atoms/src/isDisplayed.js +9 -9
  62. data/lib/capybara/selenium/driver.rb +25 -12
  63. data/lib/capybara/selenium/driver_specializations/chrome_driver.rb +10 -9
  64. data/lib/capybara/selenium/driver_specializations/edge_driver.rb +14 -10
  65. data/lib/capybara/selenium/driver_specializations/firefox_driver.rb +5 -2
  66. data/lib/capybara/selenium/driver_specializations/safari_driver.rb +0 -4
  67. data/lib/capybara/selenium/extensions/file_input_click_emulation.rb +34 -0
  68. data/lib/capybara/selenium/extensions/find.rb +19 -9
  69. data/lib/capybara/selenium/extensions/html5_drag.rb +37 -15
  70. data/lib/capybara/selenium/node.rb +62 -15
  71. data/lib/capybara/selenium/nodes/chrome_node.rb +54 -14
  72. data/lib/capybara/selenium/nodes/edge_node.rb +32 -14
  73. data/lib/capybara/selenium/nodes/firefox_node.rb +20 -6
  74. data/lib/capybara/selenium/nodes/safari_node.rb +0 -4
  75. data/lib/capybara/selenium/patches/is_displayed.rb +16 -0
  76. data/lib/capybara/server.rb +15 -3
  77. data/lib/capybara/server/checker.rb +1 -1
  78. data/lib/capybara/server/middleware.rb +20 -10
  79. data/lib/capybara/session.rb +40 -23
  80. data/lib/capybara/session/config.rb +6 -2
  81. data/lib/capybara/session/matchers.rb +6 -6
  82. data/lib/capybara/spec/public/test.js +51 -6
  83. data/lib/capybara/spec/session/all_spec.rb +60 -5
  84. data/lib/capybara/spec/session/ancestor_spec.rb +5 -0
  85. data/lib/capybara/spec/session/assert_text_spec.rb +9 -5
  86. data/lib/capybara/spec/session/click_button_spec.rb +5 -0
  87. data/lib/capybara/spec/session/fill_in_spec.rb +20 -0
  88. data/lib/capybara/spec/session/find_spec.rb +52 -0
  89. data/lib/capybara/spec/session/has_css_spec.rb +21 -3
  90. data/lib/capybara/spec/session/has_field_spec.rb +18 -0
  91. data/lib/capybara/spec/session/has_select_spec.rb +28 -0
  92. data/lib/capybara/spec/session/has_table_spec.rb +51 -5
  93. data/lib/capybara/spec/session/has_text_spec.rb +35 -0
  94. data/lib/capybara/spec/session/node_spec.rb +168 -3
  95. data/lib/capybara/spec/session/save_and_open_screenshot_spec.rb +2 -2
  96. data/lib/capybara/spec/session/save_screenshot_spec.rb +4 -4
  97. data/lib/capybara/spec/session/selectors_spec.rb +15 -2
  98. data/lib/capybara/spec/views/form.erb +17 -2
  99. data/lib/capybara/spec/views/spatial.erb +31 -0
  100. data/lib/capybara/spec/views/with_html.erb +19 -0
  101. data/lib/capybara/spec/views/with_jstree.erb +26 -0
  102. data/lib/capybara/version.rb +1 -1
  103. data/spec/basic_node_spec.rb +6 -6
  104. data/spec/capybara_spec.rb +28 -28
  105. data/spec/dsl_spec.rb +3 -3
  106. data/spec/filter_set_spec.rb +5 -5
  107. data/spec/fixtures/selenium_driver_rspec_failure.rb +1 -1
  108. data/spec/fixtures/selenium_driver_rspec_success.rb +1 -1
  109. data/spec/minitest_spec_spec.rb +46 -46
  110. data/spec/rack_test_spec.rb +10 -10
  111. data/spec/regexp_dissassembler_spec.rb +56 -38
  112. data/spec/result_spec.rb +8 -4
  113. data/spec/rspec/features_spec.rb +1 -0
  114. data/spec/rspec/shared_spec_matchers.rb +5 -5
  115. data/spec/rspec_spec.rb +5 -5
  116. data/spec/selector_spec.rb +15 -15
  117. data/spec/selenium_spec_chrome.rb +44 -1
  118. data/spec/selenium_spec_chrome_remote.rb +0 -6
  119. data/spec/selenium_spec_edge.rb +14 -15
  120. data/spec/selenium_spec_firefox.rb +8 -5
  121. data/spec/selenium_spec_firefox_remote.rb +0 -8
  122. data/spec/selenium_spec_ie.rb +1 -6
  123. data/spec/server_spec.rb +60 -18
  124. data/spec/session_spec.rb +5 -5
  125. data/spec/shared_selenium_node.rb +38 -2
  126. data/spec/shared_selenium_session.rb +8 -7
  127. metadata +9 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 799d14b5b1f64c06a58d962e7187f439332772f95d9d946d7452cf04d1710669
4
- data.tar.gz: 79d2dc83febaaae726776d509c01e591558a7a174c2e8b58733082981610c57c
3
+ metadata.gz: dd31d35629d475d7fdaba1d6e415599d995a08f27b28fa619a3a4449b61b91d8
4
+ data.tar.gz: 27c812629e2d99e8f4c62fa7961df9b499c5346b1c61092faf487f592356033d
5
5
  SHA512:
6
- metadata.gz: ccb7b53977549aaa7597577b74a5bde4ebcaee1fa9137b7aad1c7317f73b980cfb27552921386af12601febffc2326c481915d96ac6c56f87f594a9c726ea855
7
- data.tar.gz: 87c6490f0f8132750d30391aadb007ae9376d03d093c12f783ed32a3a373b33541c0ef66f7b0f7c8c069b982203542e92b33e294a80611b52dbc79e7d20021dc
6
+ metadata.gz: 946e3f2de0137ddaa6e3a2febba2c87244997737c54a10024133de110ca41b8aeddcb66e0437bef5d826e9fe21d4c42701674c3864bd578d24c30c7b1f90e2a9
7
+ data.tar.gz: f9409de3e2e0ea44e0bb6b6f77cce7e0e8f5a4d95c43fb62af2eb63d11e755d6a8c00b9b9b4d2bbe2729538d0d1038e92468e0a7994d1578b50e05b5227b87f4
data/History.md CHANGED
@@ -1,3 +1,89 @@
1
+ # Version 3.31.0
2
+ Release date: 2020-01-26
3
+
4
+ ### Added
5
+
6
+ * Support setting range inputs with the selenium driver [Andrew White]
7
+ * Support setting range inputs with the rack driver
8
+ * Support drop modifier keys in drag & drop [Elliot Crosby-McCullough]
9
+ * `enabled_options` and `disabled options` filters for select selector
10
+ * Support beginless ranges
11
+ * Optionally allow `all` results to be reloaded when stable - Beta feature - may be removed in
12
+ future version if problems occur
13
+
14
+ ### Fixed
15
+
16
+ * Fix Ruby 2.7 deprecation notices around keyword arguments. I have tried to do this without
17
+ any breaking changes, but due to the nature of the 2.7 changes and some selector types accepting
18
+ Hashes as locators there are a lot of edge cases. If you find any broken cases please report
19
+ them and I'll see if they're fixable.
20
+ * Clicking on details/summary element behavior in rack_test driver_
21
+
22
+ # Version 3.30.0
23
+ Release date: 2019-12-24
24
+
25
+ ### Added
26
+
27
+ * Display pending requests when they don't complete in time [Juan Carlos Medina]
28
+ * :order option in selector queries - set to :reverse to for reverse document order results
29
+ * Support regexp for :name and :placeholder options in selectors that import filters from
30
+ _field filter set
31
+
32
+ ### Fixed
33
+
34
+ * Issue around automatic port assignment - Issue #2245
35
+ * Label selector when label has no id - Issue #2260
36
+ * Preserve clientX/clientY in Selenium HTML5 drag emulation [Nicolò G.]
37
+ * table selector using :with_cols option if last specified column matched but others didn't - Issue #2287
38
+ * Some tests updated for Ruby 2.7 behavior change around keyword args
39
+
40
+ # Version 3.29.0
41
+ Release date: 2019-09-02
42
+
43
+ ### Added
44
+
45
+ * Allow clicking on file input when using the block version of `attach_file` with Chrome and Firefox
46
+ * Spatial filters (`left_of`, `right_of`, `above`, `below`, `near`)
47
+ * rack_test driver now supports clicking on details elements to open/close them
48
+
49
+ ### Fixed
50
+
51
+ * rack_test driver correctly determines visibility for open details elements descendants
52
+
53
+ ### Changed
54
+
55
+ * Results will now be lazily evaluated when using JRuby >= 9.2.8.0
56
+
57
+
58
+ # Version 3.28.0
59
+ Release date: 2019-08-03
60
+
61
+ ### Added
62
+
63
+ * Allow forcing HTML5 or legacy dragging via the `:html5` option to `drag_to` when using Selenium with Chrome or Firefox
64
+ * Autodetection of drag type interprets not seeing the mousedown event as legacy.
65
+ * HTML5 form validation `:valid` node filter added to `:field` and `:fillable_field` selectors
66
+ * When using Capybara registered :puma server - patches Puma 4.0.x to fix SSL connection behavior. Removes
67
+ default `queue_requests` setting - Issue #2227
68
+
69
+ # Version 3.27.0
70
+ Release date: 2019-07-28
71
+
72
+ ### Added
73
+
74
+ * Allow to use chromedriver/geckodriver native `is_element_displayed` endpoint via Selenium
75
+ driver `native_displayed` option for performance reasons. Disabled by default due to endpoints
76
+ currently not handling <details> element descendants visibility correctly.
77
+
78
+ ### Fixed
79
+
80
+ * Ignore negative lookahead/lookbehind regex when performing initial XPath text matching
81
+ * Reloading of elements found via `ancestor` and `sibling`
82
+ * Only default puma settings to `queue_requests: false` when using SSL
83
+ * Visibility of descendants of <details> elements is correctly determined when using rack_test
84
+ and the selenium driver with Capybara optimized atoms
85
+ * local/session storage clearance in Chrome when clearing only one of them - Issue #2233
86
+
1
87
  # Version 3.26.0
2
88
  Release date: 2019-07-15
3
89
 
data/README.md CHANGED
@@ -7,8 +7,7 @@
7
7
  [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/jnicklas/capybara?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
8
8
  [![SemVer](https://api.dependabot.com/badges/compatibility_score?dependency-name=capybara&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score.html?dependency-name=capybara&package-manager=bundler&version-scheme=semver)
9
9
 
10
- **Note** You are viewing the README for the 3.26.x version of Capybara.
11
-
10
+ **Note** You are viewing the README for the 3.31.x stable branch of Capybara.
12
11
 
13
12
  Capybara helps you test web applications by simulating how a real user would
14
13
  interact with your app. It is agnostic about the driver running your tests and
@@ -392,7 +391,7 @@ Capybara supports [Selenium 3.5+
392
391
  In order to use Selenium, you'll need to install the `selenium-webdriver` gem,
393
392
  and add it to your Gemfile if you're using bundler.
394
393
 
395
- Capybara pre-registers a number of named drives that use Selenium - they are:
394
+ Capybara pre-registers a number of named drivers that use Selenium - they are:
396
395
 
397
396
  * :selenium => Selenium driving Firefox
398
397
  * :selenium_headless => Selenium driving Firefox in a headless configuration
@@ -27,7 +27,9 @@ module Capybara
27
27
  attr_writer :reuse_server
28
28
 
29
29
  def threadsafe=(bool)
30
- raise 'Threadsafe setting cannot be changed once a session is created' if (bool != threadsafe) && Session.instance_created?
30
+ if (bool != threadsafe) && Session.instance_created?
31
+ raise 'Threadsafe setting cannot be changed once a session is created'
32
+ end
31
33
 
32
34
  @threadsafe = bool
33
35
  end
@@ -59,7 +61,7 @@ module Capybara
59
61
  @server = if name.respond_to? :call
60
62
  name
61
63
  elsif options
62
- proc { |app, port, host| Capybara.servers[name.to_sym].call(app, port, host, options) }
64
+ proc { |app, port, host| Capybara.servers[name.to_sym].call(app, port, host, **options) }
63
65
  else
64
66
  Capybara.servers[name.to_sym]
65
67
  end
@@ -83,7 +85,9 @@ module Capybara
83
85
 
84
86
  def deprecate(method, alternate_method, once = false)
85
87
  @deprecation_notified ||= {}
86
- warn "DEPRECATED: ##{method} is deprecated, please use ##{alternate_method} instead" unless once && @deprecation_notified[method]
88
+ unless once && @deprecation_notified[method]
89
+ warn "DEPRECATED: ##{method} is deprecated, please use ##{alternate_method} instead"
90
+ end
87
91
  @deprecation_notified[method] = true
88
92
  end
89
93
  end
@@ -113,6 +113,10 @@ module Capybara
113
113
  !!self[:multiple]
114
114
  end
115
115
 
116
+ def rect
117
+ raise NotSupportedByDriverError, 'Capybara::Driver::Node#rect'
118
+ end
119
+
116
120
  def path
117
121
  raise NotSupportedByDriverError, 'Capybara::Driver::Node#path'
118
122
  end
@@ -47,8 +47,16 @@ module Capybara
47
47
  end
48
48
 
49
49
  Session::DSL_METHODS.each do |method|
50
- define_method method do |*args, &block|
51
- page.send method, *args, &block
50
+ if RUBY_VERSION >= '2.7'
51
+ class_eval <<~METHOD, __FILE__, __LINE__ + 1
52
+ def #{method}(...)
53
+ page.method("#{method}").call(...)
54
+ end
55
+ METHOD
56
+ else
57
+ define_method method do |*args, &block|
58
+ page.send method, *args, &block
59
+ end
52
60
  end
53
61
  end
54
62
  end
@@ -87,7 +87,9 @@ module Capybara
87
87
  end
88
88
 
89
89
  def expired?
90
- raise Capybara::FrozenInTime, 'Time appears to be frozen. Capybara does not work with libraries which freeze time, consider using time travelling instead' if stalled?
90
+ if stalled?
91
+ raise Capybara::FrozenInTime, 'Time appears to be frozen. Capybara does not work with libraries which freeze time, consider using time travelling instead'
92
+ end
91
93
 
92
94
  current - @start >= @expire_in
93
95
  end
@@ -9,38 +9,38 @@ module Capybara
9
9
  ## Assert text exists
10
10
  #
11
11
  # @!method assert_text
12
- # see {Capybara::Node::Matchers#assert_text}
12
+ # @see Capybara::Node::Matchers#assert_text
13
13
 
14
14
  ## Assert text does not exist
15
15
  #
16
16
  # @!method assert_no_text
17
- # see {Capybara::Node::Matchers#assert_no_text}
17
+ # @see Capybara::Node::Matchers#assert_no_text
18
18
 
19
19
  ##
20
20
  # Assertion that page title does match
21
21
  #
22
22
  # @!method assert_title
23
- # see {Capybara::Node::DocumentMatchers#assert_title}
23
+ # @see Capybara::Node::DocumentMatchers#assert_title
24
24
 
25
25
  ##
26
26
  # Assertion that page title does not match
27
27
  #
28
28
  # @!method refute_title
29
29
  # @!method assert_no_title
30
- # see {Capybara::Node::DocumentMatchers#assert_no_title}
30
+ # @see Capybara::Node::DocumentMatchers#assert_no_title
31
31
 
32
32
  ##
33
33
  # Assertion that current path matches
34
34
  #
35
35
  # @!method assert_current_path
36
- # see {Capybara::SessionMatchers#assert_current_path}
36
+ # @see Capybara::SessionMatchers#assert_current_path
37
37
 
38
38
  ##
39
39
  # Assertion that current page does not match
40
40
  #
41
41
  # @!method refute_current_path
42
42
  # @!method assert_no_current_path
43
- # see {Capybara::SessionMatchers#assert_no_current_path}
43
+ # @see Capybara::SessionMatchers#assert_no_current_path
44
44
 
45
45
  %w[text no_text title no_title current_path no_current_path].each do |assertion_name|
46
46
  class_eval <<-ASSERTION, __FILE__, __LINE__ + 1
@@ -52,6 +52,7 @@ module Capybara
52
52
  raise ::Minitest::Assertion, e.message
53
53
  end
54
54
  ASSERTION
55
+ ruby2_keywords "assert_#{assertion_name}" if respond_to?(:ruby2_keywords)
55
56
  end
56
57
 
57
58
  alias_method :refute_title, :assert_no_title
@@ -64,37 +65,37 @@ module Capybara
64
65
  ## Assert selector exists on page
65
66
  #
66
67
  # @!method assert_selector
67
- # see {Capybara::Node::Matchers#assert_selector}
68
+ # @see Capybara::Node::Matchers#assert_selector
68
69
 
69
70
  ## Assert selector does not exist on page
70
71
  #
71
72
  # @!method assert_no_selector
72
- # see {Capybara::Node::Matchers#assert_no_selector}
73
+ # @see Capybara::Node::Matchers#assert_no_selector
73
74
 
74
75
  ## Assert element matches selector
75
76
  #
76
77
  # @!method assert_matches_selector
77
- # see {Capybara::Node::Matchers#assert_matches_selector}
78
+ # @see Capybara::Node::Matchers#assert_matches_selector
78
79
 
79
80
  ## Assert element does not match selector
80
81
  #
81
82
  # @!method assert_xpath
82
- # see {Capybara::Node::Matchers#assert_not_matches_selector}
83
+ # @see Capybara::Node::Matchers#assert_not_matches_selector
83
84
 
84
85
  ## Assert element has the provided CSS styles
85
86
  #
86
87
  # @!method assert_matches_style
87
- # see {Capybara::Node::Matchers#assert_matches_style}
88
+ # @see Capybara::Node::Matchers#assert_matches_style
88
89
 
89
90
  ## Assert element has a matching sibling
90
91
  #
91
92
  # @!method assert_sibling
92
- # see {Capybara::Node::Matchers#assert_sibling}
93
+ # @see Capybara::Node::Matchers#assert_sibling
93
94
 
94
95
  ## Assert element has a matching ancestor
95
96
  #
96
97
  # @!method assert_ancestor
97
- # see {Capybara::Node::Matchers#assert_ancestor}
98
+ # @see Capybara::Node::Matchers#assert_ancestor
98
99
 
99
100
  %w[selector no_selector matches_style
100
101
  all_of_selectors none_of_selectors any_of_selectors
@@ -109,6 +110,7 @@ module Capybara
109
110
  raise ::Minitest::Assertion, e.message
110
111
  end
111
112
  ASSERTION
113
+ ruby2_keywords "assert_#{assertion_name}" if respond_to?(:ruby2_keywords)
112
114
  end
113
115
 
114
116
  alias_method :refute_selector, :assert_no_selector
@@ -120,14 +122,16 @@ module Capybara
120
122
  define_method "assert_#{selector_type}" do |*args, &optional_filter_block|
121
123
  subject, args = determine_subject(args)
122
124
  locator, options = extract_locator(args)
123
- assert_selector(subject, selector_type.to_sym, locator, options, &optional_filter_block)
125
+ assert_selector(subject, selector_type.to_sym, locator, **options, &optional_filter_block)
124
126
  end
127
+ ruby2_keywords "assert_#{selector_type}" if respond_to?(:ruby2_keywords)
125
128
 
126
129
  define_method "assert_no_#{selector_type}" do |*args, &optional_filter_block|
127
130
  subject, args = determine_subject(args)
128
131
  locator, options = extract_locator(args)
129
- assert_no_selector(subject, selector_type.to_sym, locator, options, &optional_filter_block)
132
+ assert_no_selector(subject, selector_type.to_sym, locator, **options, &optional_filter_block)
130
133
  end
134
+ ruby2_keywords "assert_no_#{selector_type}" if respond_to?(:ruby2_keywords)
131
135
  alias_method "refute_#{selector_type}", "assert_no_#{selector_type}"
132
136
  end
133
137
 
@@ -135,14 +139,22 @@ module Capybara
135
139
  define_method "assert_#{field_type}_field" do |*args, &optional_filter_block|
136
140
  subject, args = determine_subject(args)
137
141
  locator, options = extract_locator(args)
138
- assert_selector(subject, :field, locator, options.merge(field_type.to_sym => true), &optional_filter_block)
142
+ assert_selector(subject, :field, locator, **options.merge(field_type.to_sym => true), &optional_filter_block)
139
143
  end
144
+ ruby2_keywords "assert_#{field_type}_field" if respond_to?(:ruby2_keywords)
140
145
 
141
146
  define_method "assert_no_#{field_type}_field" do |*args, &optional_filter_block|
142
147
  subject, args = determine_subject(args)
143
148
  locator, options = extract_locator(args)
144
- assert_no_selector(subject, :field, locator, options.merge(field_type.to_sym => true), &optional_filter_block)
149
+ assert_no_selector(
150
+ subject,
151
+ :field,
152
+ locator,
153
+ **options.merge(field_type.to_sym => true),
154
+ &optional_filter_block
155
+ )
145
156
  end
157
+ ruby2_keywords "assert_no_#{field_type}_field" if respond_to?(:ruby2_keywords)
146
158
  alias_method "refute_#{field_type}_field", "assert_no_#{field_type}_field"
147
159
  end
148
160
 
@@ -151,11 +163,13 @@ module Capybara
151
163
  subject, args = determine_subject(args)
152
164
  assert_matches_selector(subject, selector_type.to_sym, *args, &optional_filter_block)
153
165
  end
166
+ ruby2_keywords "assert_matches_#{selector_type}" if respond_to?(:ruby2_keywords)
154
167
 
155
168
  define_method "assert_not_matches_#{selector_type}" do |*args, &optional_filter_block|
156
169
  subject, args = determine_subject(args)
157
170
  assert_not_matches_selector(subject, selector_type.to_sym, *args, &optional_filter_block)
158
171
  end
172
+ ruby2_keywords "assert_not_matches_#{selector_type}" if respond_to?(:ruby2_keywords)
159
173
  alias_method "refute_matches_#{selector_type}", "assert_not_matches_#{selector_type}"
160
174
  end
161
175
 
@@ -163,72 +177,72 @@ module Capybara
163
177
  # Assertion that there is xpath
164
178
  #
165
179
  # @!method assert_xpath
166
- # see {Capybara::Node::Matchers#has_xpath?}
180
+ # @see Capybara::Node::Matchers#has_xpath?
167
181
 
168
182
  ##
169
183
  # Assertion that there is no xpath
170
184
  #
171
185
  # @!method refute_xpath
172
186
  # @!method assert_no_xpath
173
- # see {Capybara::Node::Matchers#has_no_xpath?}
187
+ # @see Capybara::Node::Matchers#has_no_xpath?
174
188
 
175
189
  ##
176
190
  # Assertion that there is css
177
191
  #
178
192
  # @!method assert_css
179
- # see {Capybara::Node::Matchers#has_css?}
193
+ # @see Capybara::Node::Matchers#has_css?
180
194
 
181
195
  ##
182
196
  # Assertion that there is no css
183
197
  #
184
198
  # @!method refute_css
185
199
  # @!method assert_no_css
186
- # see {Capybara::Node::Matchers#has_no_css?}
200
+ # @see Capybara::Node::Matchers#has_no_css?
187
201
 
188
202
  ##
189
203
  # Assertion that there is link
190
204
  #
191
205
  # @!method assert_link
192
- # see {Capybara::Node::Matchers#has_link?}
206
+ # @see Capybara::Node::Matchers#has_link?
193
207
 
194
208
  ##
195
209
  # Assertion that there is no link
196
210
  #
197
211
  # @!method assert_no_link
198
212
  # @!method refute_link
199
- # see {Capybara::Node::Matchers#has_no_link?}
213
+ # @see Capybara::Node::Matchers#has_no_link?
200
214
 
201
215
  ##
202
216
  # Assertion that there is button
203
217
  #
204
218
  # @!method assert_button
205
- # see {Capybara::Node::Matchers#has_button?}
219
+ # @see Capybara::Node::Matchers#has_button?
206
220
 
207
221
  ##
208
222
  # Assertion that there is no button
209
223
  #
210
224
  # @!method refute_button
211
225
  # @!method assert_no_button
212
- # see {Capybara::Node::Matchers#has_no_button?}
226
+ # @see Capybara::Node::Matchers#has_no_button?
213
227
 
214
228
  ##
215
229
  # Assertion that there is field
216
230
  #
217
231
  # @!method assert_field
218
- # see {Capybara::Node::Matchers#has_field?}
232
+ # @see Capybara::Node::Matchers#has_field?
219
233
 
220
234
  ##
221
235
  # Assertion that there is no field
222
236
  #
223
237
  # @!method refute_field
224
238
  # @!method assert_no_field
225
- # see {Capybara::Node::Matchers#has_no_field?}
239
+ # @see Capybara::Node::Matchers#has_no_field?
226
240
 
227
241
  ##
228
242
  # Assertion that there is checked_field
229
243
  #
230
244
  # @!method assert_checked_field
231
- # see {Capybara::Node::Matchers#has_checked_field?}
245
+ # @see Capybara::Node::Matchers#has_checked_field?
232
246
 
233
247
  ##
234
248
  # Assertion that there is no checked_field
@@ -240,7 +254,7 @@ module Capybara
240
254
  # Assertion that there is unchecked_field
241
255
  #
242
256
  # @!method assert_unchecked_field
243
- # see {Capybara::Node::Matchers#has_unchecked_field?}
257
+ # @see Capybara::Node::Matchers#has_unchecked_field?
244
258
 
245
259
  ##
246
260
  # Assertion that there is no unchecked_field
@@ -252,27 +266,27 @@ module Capybara
252
266
  # Assertion that there is select
253
267
  #
254
268
  # @!method assert_select
255
- # see {Capybara::Node::Matchers#has_select?}
269
+ # @see Capybara::Node::Matchers#has_select?
256
270
 
257
271
  ##
258
272
  # Assertion that there is no select
259
273
  #
260
274
  # @!method refute_select
261
275
  # @!method assert_no_select
262
- # see {Capybara::Node::Matchers#has_no_select?}
276
+ # @see Capybara::Node::Matchers#has_no_select?
263
277
 
264
278
  ##
265
279
  # Assertion that there is table
266
280
  #
267
281
  # @!method assert_table
268
- # see {Capybara::Node::Matchers#has_table?}
282
+ # @see Capybara::Node::Matchers#has_table?
269
283
 
270
284
  ##
271
285
  # Assertion that there is no table
272
286
  #
273
287
  # @!method refute_table
274
288
  # @!method assert_no_table
275
- # see {Capybara::Node::Matchers#has_no_table?}
289
+ # @see Capybara::Node::Matchers#has_no_table?
276
290
 
277
291
  private
278
292