mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Update to JRuby 9.2.7.0
This commit is contained in:
parent
94b6c8711f
commit
1e2f1b86e4
4 changed files with 14 additions and 10 deletions
|
@ -5,7 +5,7 @@ services:
|
|||
- docker
|
||||
rvm:
|
||||
- 2.6
|
||||
- jruby-9.2.6.0
|
||||
- jruby-9.2.7.0
|
||||
gemfile:
|
||||
- Gemfile
|
||||
env:
|
||||
|
|
|
@ -149,10 +149,10 @@ module Capybara
|
|||
end
|
||||
|
||||
def lazy_select_elements(&block)
|
||||
# JRuby has an issue with lazy enumerators which
|
||||
# JRuby < 9.2.8.0 has an issue with lazy enumerators which
|
||||
# causes a concurrency issue with network requests here
|
||||
# https://github.com/jruby/jruby/issues/4212
|
||||
if RUBY_PLATFORM == 'java'
|
||||
if (RUBY_PLATFORM == 'java') && (Gem::Version.new(JRUBY_VERSION) < Gem::Version.new('9.2.8.0'))
|
||||
@elements.select(&block).to_enum # non-lazy evaluation
|
||||
else
|
||||
@elements.lazy.select(&block)
|
||||
|
|
|
@ -195,7 +195,7 @@ Capybara::SpecHelper.spec 'node' do
|
|||
|
||||
it 'should see a disabled fieldset as disabled' do
|
||||
@session.visit('/form')
|
||||
expect(@session.find(:css, '#form_disabled_fieldset')).to be_disabled
|
||||
expect(@session.find(:xpath, './/fieldset[@id="form_disabled_fieldset"]')).to be_disabled
|
||||
end
|
||||
|
||||
context 'in a disabled fieldset' do
|
||||
|
|
|
@ -106,7 +106,7 @@ RSpec.describe Capybara::Result do
|
|||
|
||||
# Not a great test but it indirectly tests what is needed
|
||||
it 'should evaluate filters lazily for idx' do
|
||||
skip 'JRuby has an issue with lazy enumerator evaluation' if RUBY_PLATFORM == 'java'
|
||||
skip 'JRuby has an issue with lazy enumerator evaluation' if jruby_lazy_enumerator_workaround?
|
||||
# Not processed until accessed
|
||||
expect(result.instance_variable_get('@result_cache').size).to be 0
|
||||
|
||||
|
@ -127,7 +127,7 @@ RSpec.describe Capybara::Result do
|
|||
end
|
||||
|
||||
it 'should evaluate filters lazily for range' do
|
||||
skip 'JRuby has an issue with lazy enumerator evaluation' if RUBY_PLATFORM == 'java'
|
||||
skip 'JRuby has an issue with lazy enumerator evaluation' if jruby_lazy_enumerator_workaround?
|
||||
result[0..1]
|
||||
expect(result.instance_variable_get('@result_cache').size).to be 2
|
||||
|
||||
|
@ -136,7 +136,7 @@ RSpec.describe Capybara::Result do
|
|||
end
|
||||
|
||||
it 'should evaluate filters lazily for idx and length' do
|
||||
skip 'JRuby has an issue with lazy enumerator evaluation' if RUBY_PLATFORM == 'java'
|
||||
skip 'JRuby has an issue with lazy enumerator evaluation' if jruby_lazy_enumerator_workaround?
|
||||
result[1, 2]
|
||||
expect(result.instance_variable_get('@result_cache').size).to be 3
|
||||
|
||||
|
@ -145,7 +145,7 @@ RSpec.describe Capybara::Result do
|
|||
end
|
||||
|
||||
it 'should only need to evaluate one result for any?' do
|
||||
skip 'JRuby has an issue with lazy enumerator evaluation' if RUBY_PLATFORM == 'java'
|
||||
skip 'JRuby has an issue with lazy enumerator evaluation' if jruby_lazy_enumerator_workaround?
|
||||
result.any?
|
||||
expect(result.instance_variable_get('@result_cache').size).to be 1
|
||||
end
|
||||
|
@ -158,7 +158,7 @@ RSpec.describe Capybara::Result do
|
|||
|
||||
context '#each' do
|
||||
it 'lazily evaluates' do
|
||||
skip 'JRuby has an issue with lazy enumerator evaluation' if RUBY_PLATFORM == 'java'
|
||||
skip 'JRuby has an issue with lazy enumerator evaluation' if jruby_lazy_enumerator_workaround?
|
||||
results = []
|
||||
result.each do |el|
|
||||
results << el
|
||||
|
@ -174,7 +174,7 @@ RSpec.describe Capybara::Result do
|
|||
end
|
||||
|
||||
it 'lazily evaluates' do
|
||||
skip 'JRuby has an issue with lazy enumerator evaluation' if RUBY_PLATFORM == 'java'
|
||||
skip 'JRuby has an issue with lazy enumerator evaluation' if jruby_lazy_enumerator_workaround?
|
||||
result.each.with_index do |_el, idx|
|
||||
expect(result.instance_variable_get('@result_cache').size).to eq(idx + 1) # 0 indexing
|
||||
end
|
||||
|
@ -197,4 +197,8 @@ RSpec.describe Capybara::Result do
|
|||
expect(eval_count).to eq 1
|
||||
end
|
||||
end
|
||||
|
||||
def jruby_lazy_enumerator_workaround?
|
||||
(RUBY_PLATFORM == 'java') && (Gem::Version.new(JRUBY_VERSION) < Gem::Version.new('9.2.8.0'))
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue