Skip to content

Commit

Permalink
Drop support for ruby 3.0.x
Browse files Browse the repository at this point in the history
  • Loading branch information
twalpole committed Jan 26, 2024
1 parent e844a6f commit b349c28
Show file tree
Hide file tree
Showing 39 changed files with 183 additions and 183 deletions.
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require:
AllCops:
NewCops: enable
DisabledByDefault: false
TargetRubyVersion: 3.0
TargetRubyVersion: 3.1
Exclude:
- 'vendor/**/*'
- 'gemfiles/vendor/**/*'
Expand Down
2 changes: 1 addition & 1 deletion capybara.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require 'capybara/version'
Gem::Specification.new do |s|
s.name = 'capybara'
s.version = Capybara::VERSION
s.required_ruby_version = '>= 3.0.0'
s.required_ruby_version = '>= 3.1.0'
s.license = 'MIT'

s.authors = ['Thomas Walpole', 'Jonas Nicklas']
Expand Down
16 changes: 8 additions & 8 deletions lib/capybara.rb
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ def register_server(name, &block)
# @param [Symbol] name The name of the selector to add
# @yield A block executed in the context of the new {Capybara::Selector}
#
def add_selector(name, **options, &block)
Capybara::Selector.add(name, **options, &block)
def add_selector(name, **options, &)
Capybara::Selector.add(name, **options, &)
end

##
Expand All @@ -197,8 +197,8 @@ def add_selector(name, **options, &block)
# @param [Symbol] name The name of the selector to modify
# @yield A block executed in the context of the existing {Capybara::Selector}
#
def modify_selector(name, &block)
Capybara::Selector.update(name, &block)
def modify_selector(name, &)
Capybara::Selector.update(name, &)
end

def drivers
Expand Down Expand Up @@ -358,10 +358,10 @@ def session_name=(name)
def using_session(name_or_session, &block)
previous_session = current_session
previous_session_info = {
specified_session: specified_session,
session_name: session_name,
current_driver: current_driver,
app: app
specified_session:,
session_name:,
current_driver:,
app:
}
self.specified_session = self.session_name = nil
if name_or_session.is_a? Capybara::Session
Expand Down
4 changes: 2 additions & 2 deletions lib/capybara/driver/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def no_such_window_error
# @return [String] the message shown in the modal
# @raise [Capybara::ModalNotFound] if modal dialog hasn't been found
#
def accept_modal(type, **options, &blk)
def accept_modal(type, **options, &)
raise Capybara::NotSupportedByDriverError, 'Capybara::Driver::Base#accept_modal'
end

Expand All @@ -148,7 +148,7 @@ def accept_modal(type, **options, &blk)
# @return [String] the message shown in the modal
# @raise [Capybara::ModalNotFound] if modal dialog hasn't been found
#
def dismiss_modal(type, **options, &blk)
def dismiss_modal(type, **options, &)
raise Capybara::NotSupportedByDriverError, 'Capybara::Driver::Base#dismiss_modal'
end

Expand Down
8 changes: 4 additions & 4 deletions lib/capybara/dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ def self.extended(base)
#
# Shortcut to working in a different session.
#
def using_session(name_or_session, &block)
Capybara.using_session(name_or_session, &block)
def using_session(name_or_session, &)
Capybara.using_session(name_or_session, &)
end

# Shortcut to using a different wait time.
#
def using_wait_time(seconds, &block)
page.using_wait_time(seconds, &block)
def using_wait_time(seconds, &)
page.using_wait_time(seconds, &)
end

##
Expand Down
2 changes: 1 addition & 1 deletion lib/capybara/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def filter_backtrace(trace)
end

def warn(message, uplevel: 1)
Kernel.warn(message, uplevel: uplevel)
Kernel.warn(message, uplevel:)
end

if defined?(Process::CLOCK_MONOTONIC_RAW)
Expand Down
2 changes: 1 addition & 1 deletion lib/capybara/node/document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def inspect
# @return [String] The text of the document
#
def text(type = nil, normalize_ws: false)
find(:xpath, '/html').text(type, normalize_ws: normalize_ws)
find(:xpath, '/html').text(type, normalize_ws:)
end

##
Expand Down
32 changes: 16 additions & 16 deletions lib/capybara/node/finders.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ module Finders
# @return [Capybara::Node::Element] The found element
# @raise [Capybara::ElementNotFound] If the element can't be found before time expires
#
def find(*args, **options, &optional_filter_block)
def find(*args, **options, &)
options[:session_options] = session_options
count_options = options.slice(*Capybara::Queries::BaseQuery::COUNT_KEYS)
unless count_options.empty?
Expand All @@ -57,7 +57,7 @@ def find(*args, **options, &optional_filter_block)
"Called from: #{Capybara::Helpers.filter_backtrace(caller)}"
)
end
synced_resolve Capybara::Queries::SelectorQuery.new(*args, **options, &optional_filter_block)
synced_resolve Capybara::Queries::SelectorQuery.new(*args, **options, &)
end

##
Expand All @@ -78,9 +78,9 @@ def find(*args, **options, &optional_filter_block)
# @return [Capybara::Node::Element] The found element
# @raise [Capybara::ElementNotFound] If the element can't be found before time expires
#
def ancestor(*args, **options, &optional_filter_block)
def ancestor(*args, **options, &)
options[:session_options] = session_options
synced_resolve Capybara::Queries::AncestorQuery.new(*args, **options, &optional_filter_block)
synced_resolve Capybara::Queries::AncestorQuery.new(*args, **options, &)
end

##
Expand All @@ -101,9 +101,9 @@ def ancestor(*args, **options, &optional_filter_block)
# @return [Capybara::Node::Element] The found element
# @raise [Capybara::ElementNotFound] If the element can't be found before time expires
#
def sibling(*args, **options, &optional_filter_block)
def sibling(*args, **options, &)
options[:session_options] = session_options
synced_resolve Capybara::Queries::SiblingQuery.new(*args, **options, &optional_filter_block)
synced_resolve Capybara::Queries::SiblingQuery.new(*args, **options, &)
end

##
Expand Down Expand Up @@ -132,8 +132,8 @@ def sibling(*args, **options, &optional_filter_block)
# @option options [String, Array<String>, Regexp] class Match fields that match the class(es) passed
# @return [Capybara::Node::Element] The found element
#
def find_field(locator = nil, **options, &optional_filter_block)
find(:field, locator, **options, &optional_filter_block)
def find_field(locator = nil, **options, &)
find(:field, locator, **options, &)
end

##
Expand All @@ -154,8 +154,8 @@ def find_field(locator = nil, **options, &optional_filter_block)
# @option options [String, Array<String>, Regexp] class Match links that match the class(es) provided
# @return [Capybara::Node::Element] The found element
#
def find_link(locator = nil, **options, &optional_filter_block)
find(:link, locator, **options, &optional_filter_block)
def find_link(locator = nil, **options, &)
find(:link, locator, **options, &)
end

##
Expand All @@ -181,8 +181,8 @@ def find_link(locator = nil, **options, &optional_filter_block)
# @option options [String, Array<String>, Regexp] class Match buttons that match the class(es) provided
# @return [Capybara::Node::Element] The found element
#
def find_button(locator = nil, **options, &optional_filter_block)
find(:button, locator, **options, &optional_filter_block)
def find_button(locator = nil, **options, &)
find(:button, locator, **options, &)
end

##
Expand All @@ -195,8 +195,8 @@ def find_button(locator = nil, **options, &optional_filter_block)
#
# @return [Capybara::Node::Element] The found element
#
def find_by_id(id, **options, &optional_filter_block)
find(:id, id, **options, &optional_filter_block)
def find_by_id(id, **options, &)
find(:id, id, **options, &)
end

##
Expand Down Expand Up @@ -290,9 +290,9 @@ def all(*args, allow_reload: false, **options, &optional_filter_block)
# @return [Capybara::Node::Element] The found element or nil
# @raise [Capybara::ElementNotFound] If element(s) matching the provided options can't be found before time expires
#
def first(*args, **options, &optional_filter_block)
def first(*args, **options, &)
options = { minimum: 1 }.merge(options) unless options_include_minimum?(options)
all(*args, **options, &optional_filter_block).first
all(*args, **options, &).first
end

private
Expand Down
Loading

0 comments on commit b349c28

Please sign in to comment.