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

View File

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

View File

@ -2,7 +2,7 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe Capybara::Result do RSpec.describe Capybara::Result, :focus_ do
let :string do let :string do
Capybara.string <<-STRING Capybara.string <<-STRING
<ul> <ul>
@ -166,7 +166,7 @@ RSpec.describe Capybara::Result do
context 'lazy select' do context 'lazy select' do
it 'is compatible' do it 'is compatible' do
# This test will let us know when JRuby fixes lazy select so we can re-enable it in Result # 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 eval_count = 0
enum = %w[Text1 Text2 Text3].lazy.select do enum = %w[Text1 Text2 Text3].lazy.select do
eval_count += 1 eval_count += 1