1
0
Fork 0
mirror of https://github.com/teamcapybara/capybara.git synced 2022-11-09 12:08:07 -05:00

JRuby 9.2.8.0 has been released and no longer needs the lazy results workaround

This commit is contained in:
Thomas Walpole 2019-08-14 15:56:06 -07:00
parent f5c008dfbd
commit 2e052792a5
3 changed files with 8 additions and 9 deletions

View file

@ -7,7 +7,7 @@ services:
- docker
rvm:
- 2.6
- jruby-9.2.7.0
- jruby-9.2.8.0
gemfile:
- Gemfile
env:
@ -128,7 +128,6 @@ matrix:
- gemfile: gemfiles/Gemfile.beta-versions
- gemfile: gemfiles/Gemfile.edge-firefox
- env: CHROME_BETA=true HEADLESS=true
- rvm: jruby-9.2.7.0
before_install:
- gem update --system
- if [[ $BUNDLE_GEMFILE =~ Gemfile.edge-firefox$ ]]; then

View file

@ -150,15 +150,15 @@ module Capybara
@rest ||= @elements - full_results
end
def lazy_select_elements(&block)
if (RUBY_PLATFORM == 'java') && (Gem::Version.new(JRUBY_VERSION) < Gem::Version.new('9.2.8.0'))
# 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') && (Gem::Version.new(JRUBY_VERSION) < Gem::Version.new('9.2.8.0'))
# :nocov:
def lazy_select_elements(&block)
@elements.select(&block).to_enum # non-lazy evaluation
# :nocov:
else
end
else
def lazy_select_elements(&block)
@elements.lazy.select(&block)
end
end

View file

@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe Capybara::Result do
RSpec.describe Capybara::Result, :focus_ do
let :string do
Capybara.string <<-STRING
<ul>
@ -166,7 +166,7 @@ RSpec.describe Capybara::Result do
context 'lazy select' do
it 'is compatible' do
# This test will let us know when JRuby fixes lazy select so we can re-enable it in Result
pending 'JRuby has an issue with lazy enumberator evaluation' if RUBY_PLATFORM == 'java'
pending 'JRuby < 9.2.8.0 has an issue with lazy enumberator evaluation' if jruby_lazy_enumerator_workaround?
eval_count = 0
enum = %w[Text1 Text2 Text3].lazy.select do
eval_count += 1