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

Add a test to identify when JRuby fixes lazy enumeration

This commit is contained in:
Thomas Walpole 2018-05-03 14:19:03 -07:00
parent aeedcbf578
commit 26bc517afe

View file

@ -143,4 +143,20 @@ RSpec.describe Capybara::Result do
end
end
end
context 'lazy select', :focus_ 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'
eval_count = 0
enum = ["Text1", "Text2", "Text3"].lazy.select do |t|
eval_count += 1
true
end
expect(eval_count).to eq 0
enum.next
sleep 1
expect(eval_count).to eq 1
end
end
end