From 2e052792a59d0c183ff42009cc73bf7e9eae43c6 Mon Sep 17 00:00:00 2001 From: Thomas Walpole Date: Wed, 14 Aug 2019 15:56:06 -0700 Subject: [PATCH] JRuby 9.2.8.0 has been released and no longer needs the lazy results workaround --- .travis.yml | 3 +-- lib/capybara/result.rb | 10 +++++----- spec/result_spec.rb | 4 ++-- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9c11c2de..1150f341 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/lib/capybara/result.rb b/lib/capybara/result.rb index ff63a62f..33f5754f 100644 --- a/lib/capybara/result.rb +++ b/lib/capybara/result.rb @@ -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 diff --git a/spec/result_spec.rb b/spec/result_spec.rb index f5f79001..efedd8b4 100644 --- a/spec/result_spec.rb +++ b/spec/result_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Capybara::Result do +RSpec.describe Capybara::Result, :focus_ do let :string do Capybara.string <<-STRING