1
0
Fork 0
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:
Thomas Walpole 2019-04-11 15:01:59 -07:00
parent 94b6c8711f
commit 1e2f1b86e4
4 changed files with 14 additions and 10 deletions

View file

@ -5,7 +5,7 @@ services:
- docker - docker
rvm: rvm:
- 2.6 - 2.6
- jruby-9.2.6.0 - jruby-9.2.7.0
gemfile: gemfile:
- Gemfile - Gemfile
env: env:

View file

@ -149,10 +149,10 @@ module Capybara
end end
def lazy_select_elements(&block) 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 # causes a concurrency issue with network requests here
# https://github.com/jruby/jruby/issues/4212 # 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 @elements.select(&block).to_enum # non-lazy evaluation
else else
@elements.lazy.select(&block) @elements.lazy.select(&block)

View file

@ -195,7 +195,7 @@ Capybara::SpecHelper.spec 'node' do
it 'should see a disabled fieldset as disabled' do it 'should see a disabled fieldset as disabled' do
@session.visit('/form') @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 end
context 'in a disabled fieldset' do context 'in a disabled fieldset' do

View file

@ -106,7 +106,7 @@ RSpec.describe Capybara::Result do
# Not a great test but it indirectly tests what is needed # Not a great test but it indirectly tests what is needed
it 'should evaluate filters lazily for idx' do 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 # Not processed until accessed
expect(result.instance_variable_get('@result_cache').size).to be 0 expect(result.instance_variable_get('@result_cache').size).to be 0
@ -127,7 +127,7 @@ RSpec.describe Capybara::Result do
end end
it 'should evaluate filters lazily for range' do 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] result[0..1]
expect(result.instance_variable_get('@result_cache').size).to be 2 expect(result.instance_variable_get('@result_cache').size).to be 2
@ -136,7 +136,7 @@ RSpec.describe Capybara::Result do
end end
it 'should evaluate filters lazily for idx and length' do 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] result[1, 2]
expect(result.instance_variable_get('@result_cache').size).to be 3 expect(result.instance_variable_get('@result_cache').size).to be 3
@ -145,7 +145,7 @@ RSpec.describe Capybara::Result do
end end
it 'should only need to evaluate one result for any?' do 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? result.any?
expect(result.instance_variable_get('@result_cache').size).to be 1 expect(result.instance_variable_get('@result_cache').size).to be 1
end end
@ -158,7 +158,7 @@ RSpec.describe Capybara::Result do
context '#each' do context '#each' do
it 'lazily evaluates' 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 = [] results = []
result.each do |el| result.each do |el|
results << el results << el
@ -174,7 +174,7 @@ RSpec.describe Capybara::Result do
end end
it 'lazily evaluates' 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?
result.each.with_index do |_el, idx| result.each.with_index do |_el, idx|
expect(result.instance_variable_get('@result_cache').size).to eq(idx + 1) # 0 indexing expect(result.instance_variable_get('@result_cache').size).to eq(idx + 1) # 0 indexing
end end
@ -197,4 +197,8 @@ RSpec.describe Capybara::Result do
expect(eval_count).to eq 1 expect(eval_count).to eq 1
end end
end end
def jruby_lazy_enumerator_workaround?
(RUBY_PLATFORM == 'java') && (Gem::Version.new(JRUBY_VERSION) < Gem::Version.new('9.2.8.0'))
end
end end