Skip to content

Instantly share code, notes, and snippets.

@stevo
Created July 27, 2018 07:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevo/1367f0ae3bf61f90bcb3f36b7af033a2 to your computer and use it in GitHub Desktop.
Save stevo/1367f0ae3bf61f90bcb3f36b7af033a2 to your computer and use it in GitHub Desktop.
with_enumerated(Poller, :poll) do
$stop = false
poller = Poller.poll(condition: -> { $stop == true })
first_value = poller.next
expect(first_value).to eq 1
$stop = true
second_value = poller.next
expect(second_value).to eq 2
expect { poller.next }.to raise_exception(StopIteration)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment