lib/rspec/wait/handler.rb in rspec-wait-0.0.3 vs lib/rspec/wait/handler.rb in rspec-wait-0.0.4
- old
+ new
@@ -1,26 +1,20 @@
-require "rspec"
require "timeout"
-require "rspec/wait/error"
-
module RSpec
module Wait
module Handler
- TIMEOUT = 10
- DELAY = 0.1
-
def handle_matcher(target, *args, &block)
failure = nil
- Timeout.timeout(TIMEOUT) do
+ Timeout.timeout(RSpec.configuration.wait_timeout) do
loop do
begin
actual = target.respond_to?(:call) ? target.call : target
super(actual, *args, &block)
break
rescue RSpec::Expectations::ExpectationNotMetError => failure
- sleep DELAY
+ sleep RSpec.configuration.wait_delay
retry
end
end
end
rescue Timeout::Error