mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Drop support for Ruby 2.5.x
This commit is contained in:
parent
d8ceecb4cd
commit
9ca027a14a
8 changed files with 21 additions and 29 deletions
|
@ -3,11 +3,11 @@ require:
|
|||
- rubocop-performance
|
||||
- rubocop-minitest
|
||||
- rubocop-rake
|
||||
|
||||
|
||||
AllCops:
|
||||
NewCops: enable
|
||||
DisabledByDefault: false
|
||||
TargetRubyVersion: 2.5
|
||||
TargetRubyVersion: 2.6
|
||||
Exclude:
|
||||
- 'vendor/**/*'
|
||||
- 'gemfiles/vendor/**/*'
|
||||
|
@ -15,7 +15,7 @@ AllCops:
|
|||
#################### Lint ################################
|
||||
|
||||
Layout/LineLength:
|
||||
Description: 'Limit lines to 80 characters.'
|
||||
Description: 'Limit lines to 120 characters.'
|
||||
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#80-character-limits'
|
||||
Exclude:
|
||||
- 'spec/**/*'
|
||||
|
@ -246,7 +246,7 @@ Performance/StringInclude:
|
|||
|
||||
Performance/MethodObjectAsBlock:
|
||||
Enabled: false
|
||||
|
||||
|
||||
Performance/BlockGivenWithExplicitBlock:
|
||||
Enabled: false
|
||||
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
# Version 3.36.0
|
||||
Release date: unreleased
|
||||
|
||||
### Changed
|
||||
|
||||
* Ruby 2.6.0+ is now required
|
||||
|
||||
### Fixed
|
||||
|
||||
* Sibling and ancestor queries now work with Simple::Node - Issue #2452
|
||||
|
|
|
@ -74,7 +74,7 @@ GitHub): http://groups.google.com/group/ruby-capybara
|
|||
|
||||
## <a name="setup"></a>Setup
|
||||
|
||||
Capybara requires Ruby 2.5.0 or later. To install, add this line to your
|
||||
Capybara requires Ruby 2.6.0 or later. To install, add this line to your
|
||||
`Gemfile` and run `bundle install`:
|
||||
|
||||
```ruby
|
||||
|
|
|
@ -8,7 +8,7 @@ require 'capybara/version'
|
|||
Gem::Specification.new do |s|
|
||||
s.name = 'capybara'
|
||||
s.version = Capybara::VERSION
|
||||
s.required_ruby_version = '>= 2.5.0'
|
||||
s.required_ruby_version = '>= 2.6.0'
|
||||
s.license = 'MIT'
|
||||
|
||||
s.authors = ['Thomas Walpole', 'Jonas Nicklas']
|
||||
|
|
|
@ -82,16 +82,7 @@ module Capybara
|
|||
end
|
||||
|
||||
def warn(message, uplevel: 1)
|
||||
return Kernel.warn(message, uplevel: uplevel) if RUBY_VERSION >= '2.6'
|
||||
|
||||
# TODO: Remove when we drop support for Ruby 2.5
|
||||
# Workaround for emulating `warn '...', uplevel: n` in Ruby 2.5 or lower.
|
||||
if (match = /^(?<file>.+?):(?<line>\d+)(?::in `.*')?/.match(caller[uplevel]))
|
||||
location = [match[:file], match[:line]].join(':')
|
||||
Kernel.warn "#{location}: #{message}"
|
||||
else
|
||||
Kernel.warn message
|
||||
end
|
||||
Kernel.warn(message, uplevel: uplevel)
|
||||
end
|
||||
|
||||
if defined?(Process::CLOCK_MONOTONIC)
|
||||
|
|
|
@ -282,7 +282,7 @@ private
|
|||
if rapid == true || ((value.length > auto_rapid_set_length) && rapid != false)
|
||||
send_keys(value[0..3])
|
||||
driver.execute_script RAPID_APPEND_TEXT, self, value[4...-3]
|
||||
send_keys(value[-3..-1])
|
||||
send_keys(value[-3..])
|
||||
else
|
||||
send_keys(value)
|
||||
end
|
||||
|
|
|
@ -203,12 +203,10 @@ Capybara::SpecHelper.spec '#all' do
|
|||
expect { @session.all(:css, 'h1, p', between: 0..3) }.to raise_error(Capybara::ExpectationNotMet)
|
||||
end
|
||||
|
||||
eval <<~TEST, binding, __FILE__, __LINE__ + 1 if RUBY_VERSION.to_f > 2.5
|
||||
it'treats an endless range as minimum' do
|
||||
expect { @session.all(:css, 'h1, p', between: 2..) }.not_to raise_error
|
||||
expect { @session.all(:css, 'h1, p', between: 5..) }.to raise_error(Capybara::ExpectationNotMet)
|
||||
end
|
||||
TEST
|
||||
it 'treats an endless range as minimum' do
|
||||
expect { @session.all(:css, 'h1, p', between: 2..) }.not_to raise_error
|
||||
expect { @session.all(:css, 'h1, p', between: 5..) }.to raise_error(Capybara::ExpectationNotMet)
|
||||
end
|
||||
|
||||
eval <<~TEST, binding, __FILE__, __LINE__ + 1 if RUBY_VERSION.to_f > 2.6
|
||||
it'treats a beginless range as maximum' do
|
||||
|
|
|
@ -78,14 +78,13 @@ RSpec.describe Capybara::Result do
|
|||
expect(recalc_result[1...3].map(&:text)).to eq %w[Beta Gamma]
|
||||
expect(recalc_result[1..7].map(&:text)).to eq %w[Beta Gamma Delta]
|
||||
expect(recalc_result[2...-1].map(&:text)).to eq %w[Gamma]
|
||||
expect(recalc_result[2..-1].map(&:text)).to eq %w[Gamma Delta]
|
||||
expect(recalc_result[2..-1].map(&:text)).to eq %w[Gamma Delta] # rubocop:disable Style/SlicingWithRange
|
||||
expect(recalc_result[2..].map(&:text)).to eq %w[Gamma Delta]
|
||||
end
|
||||
|
||||
eval <<~TEST, binding, __FILE__, __LINE__ + 1 if RUBY_VERSION.to_f > 2.5
|
||||
it 'supports endless ranges' do
|
||||
expect(result[2..].map(&:text)).to eq %w[Gamma Delta]
|
||||
end
|
||||
TEST
|
||||
it 'supports endless ranges' do
|
||||
expect(result[2..].map(&:text)).to eq %w[Gamma Delta]
|
||||
end
|
||||
|
||||
eval <<~TEST, binding, __FILE__, __LINE__ + 1 if RUBY_VERSION.to_f > 2.6
|
||||
it 'supports inclusive positive beginless ranges' do
|
||||
|
|
Loading…
Reference in a new issue