1- require 'ruby2_keywords'
2-
31module Capybara
42 module Lockstep
53 module SynchronizeMacros
@@ -13,43 +11,37 @@ def self.extended(by)
1311
1412 def synchronize_before ( meth , lazy :)
1513 @synchronize_before_module . module_eval do
16- define_method meth do |*args , &block |
14+ define_method meth do |*args , ** kwargs , &block |
1715 @synchronize_before_count ||= 0
1816 @synchronize_before_count += 1
1917 Lockstep . auto_synchronize ( lazy : lazy , log : "Synchronizing before ##{ meth } " ) if @synchronize_before_count == 1
20- super ( *args , &block )
18+ super ( *args , ** kwargs , &block )
2119 ensure
2220 @synchronize_before_count -= 1
2321 end
24-
25- ruby2_keywords meth
2622 end
2723 end
2824
2925 def synchronize_after ( meth )
3026 @synchronize_after_module . module_eval do
31- define_method meth do |*args , &block |
27+ define_method meth do |*args , ** kwargs , &block |
3228 @synchronize_after_count ||= 0
3329 @synchronize_after_count += 1
34- super ( *args , &block )
30+ super ( *args , ** kwargs , &block )
3531 ensure
3632 Lockstep . auto_synchronize ( log : "Synchronizing after ##{ meth } " ) if @synchronize_after_count == 1
3733 @synchronize_after_count -= 1
3834 end
39-
40- ruby2_keywords meth
4135 end
4236 end
4337
4438 def unsynchronize_after ( meth )
4539 @unsynchronize_after_module . module_eval do
46- define_method meth do |*args , &block |
47- super ( *args , &block )
40+ define_method meth do |*args , ** kwargs , &block |
41+ super ( *args , ** kwargs , &block )
4842 ensure
4943 Lockstep . unsynchronize
5044 end
51-
52- ruby2_keywords meth
5345 end
5446 end
5547 end
@@ -82,7 +74,7 @@ def unsynchronize_after(meth)
8274module Capybara
8375 module Lockstep
8476 module VisitWithWaiting
85- def visit ( *args , &block )
77+ def visit ( *args , ** kwargs , &block )
8678 # For some reason, in Capybara proper, visit(nil) navigates to the root route.
8779 # We mimic this behavior for (1) parity and (2) to not crash when we inspect the URL below.
8880 url = args [ 0 ] . presence || '/'
@@ -104,15 +96,13 @@ def visit(*args, &block)
10496 Lockstep . auto_synchronize ( lazy : false , log : "Synchronizing before visiting #{ url } " )
10597 end
10698
107- super ( *args , &block ) . tap do
99+ super ( *args , ** kwargs , &block ) . tap do
108100 if visiting_real_url
109101 # We haven't yet synchronized the new screen.
110102 Lockstep . unsynchronize
111103 end
112104 end
113105 end
114-
115- ruby2_keywords :visit
116106 end
117107 end
118108end
@@ -127,7 +117,7 @@ module SynchronizeAroundScriptMethod
127117
128118 def synchronize_around_script_method ( meth )
129119 mod = Module . new do
130- define_method meth do |script , *args , &block |
120+ define_method meth do |script , *args , ** kwargs , &block |
131121 # Synchronization uses execute_script itself, so don't synchronize when
132122 # we're already synchronizing.
133123 if !Lockstep . synchronizing?
@@ -142,16 +132,14 @@ def synchronize_around_script_method(meth)
142132 Lockstep . auto_synchronize ( lazy : !script_may_navigate_away , log : "Synchronizing before script: #{ script } " )
143133 end
144134
145- super ( script , *args , &block )
135+ super ( script , *args , ** kwargs , &block )
146136 ensure
147137 if !Lockstep . synchronizing?
148138 # We haven't yet synchronized with whatever changes the JavaScript
149139 # did on the frontend.
150140 Lockstep . unsynchronize
151141 end
152142 end
153-
154- ruby2_keywords meth
155143 end
156144 prepend ( mod )
157145 end
@@ -246,16 +234,14 @@ def synchronize_around_script_method(meth)
246234module Capybara
247235 module Lockstep
248236 module SynchronizeWithCatchUp
249- def synchronize ( *args , &block )
237+ def synchronize ( *args , ** kwargs , &block )
250238 # This method is called by Capybara before most interactions with
251239 # the browser. It is a different method than Capybara::Lockstep.synchronize!
252240 # We use the { lazy } option to only synchronize when we're out of sync.
253241 Lockstep . auto_synchronize ( lazy : true , log : 'Synchronizing before node access' )
254242
255- super ( *args , &block )
243+ super ( *args , ** kwargs , &block )
256244 end
257-
258- ruby2_keywords :synchronize
259245 end
260246 end
261247end
0 commit comments