Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist
View wait_steps.rb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
require "timeout"
 
module WaitSteps
extend RSpec::Matchers::DSL
 
matcher :become_true do
match do |block|
begin
Timeout.timeout(Capybara.default_wait_time) do
sleep(0.1) until value = block.call
value
end
rescue TimeoutError
false
end
end
end
end

in Rspec 3.1 you need to add a:

def supports_block_expectations?
  true
end

to the matcher

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.