Skip to content

Commit b80382f

Browse files
committed
fix for Ruby 2.4
1 parent 5571ba3 commit b80382f

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

lib/capybara/playwright/node.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,20 @@ def capybara_obscured?(x: nil, y: nil)
198198
end
199199
::Playwright::ElementHandle.prepend(CapybaraObscuredPatch)
200200

201+
# ref: https://github.com/teamcapybara/capybara/pull/2424
202+
module ElementDropPathCompatPatch
203+
def drop(*args)
204+
options = args.map { |arg| arg.respond_to?(:to_path) ? arg.to_path : arg }
205+
synchronize { base.drop(*options) }
206+
self
207+
end
208+
end
209+
if Gem::Version.new(Capybara::VERSION) < Gem::Version.new('3.34.0')
210+
# Older Capybara returns early for Pathname arguments in Element#drop,
211+
# so the driver implementation never runs.
212+
Node::Element.prepend(ElementDropPathCompatPatch)
213+
end
214+
201215
module Playwright
202216
# Selector and checking methods are derived from twapole/apparition
203217
# Action methods (click, select_option, ...) uses playwright.

0 commit comments

Comments
 (0)