Sha256: d69dabd71e1daa8877a70330d0af728387efbd8af9f4a0b32696cf97bf1bbfd2

Contents?: true

Size: 1.06 KB

Versions: 73

Compression:

Stored size: 1.06 KB

Contents

require "timeout"

module RSpec
  module Wait
    module Handler
      def handle_matcher(target, *args, &block)
        failure = nil

        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 RSpec.configuration.wait_delay
              retry
            end
          end
        end
      rescue Timeout::Error
        raise failure || TimeoutError
      end
    end

    # From: https://github.com/rspec/rspec-expectations/blob/v3.0.0/lib/rspec/expectations/handler.rb#L44-L63
    class PositiveHandler < RSpec::Expectations::PositiveExpectationHandler
      extend Handler
    end

    # From: https://github.com/rspec/rspec-expectations/blob/v3.0.0/lib/rspec/expectations/handler.rb#L66-L93
    class NegativeHandler < RSpec::Expectations::NegativeExpectationHandler
      extend Handler
    end
  end
end

Version data entries

73 entries across 68 versions & 18 rubygems

Version Path
logstash-output-scalyr-0.2.1.beta vendor/bundle/jruby/2.5.0/gems/rspec-wait-0.0.9/lib/rspec/wait/handler.rb
logstash-output-scalyr-0.2.0 vendor/bundle/jruby/2.5.0/gems/rspec-wait-0.0.9/lib/rspec/wait/handler.rb
logstash-output-scalyr-0.2.0.beta vendor/bundle/jruby/2.5.0/gems/rspec-wait-0.0.9/lib/rspec/wait/handler.rb
logstash-output-scalyr-0.1.26.beta vendor/bundle/jruby/2.5.0/gems/rspec-wait-0.0.9/lib/rspec/wait/handler.rb
logstash-output-scalyr-0.1.25.beta vendor/bundle/jruby/2.5.0/gems/rspec-wait-0.0.9/lib/rspec/wait/handler.rb
logstash-output-scalyr-0.1.24.beta vendor/bundle/jruby/2.5.0/gems/rspec-wait-0.0.9/lib/rspec/wait/handler.rb
logstash-output-scalyr-0.1.23.beta vendor/bundle/jruby/2.5.0/gems/rspec-wait-0.0.9/lib/rspec/wait/handler.rb
logstash-output-scalyr-0.1.22.beta vendor/bundle/jruby/2.5.0/gems/rspec-wait-0.0.9/lib/rspec/wait/handler.rb
logstash-output-scalyr-0.1.21.beta vendor/bundle/jruby/2.5.0/gems/rspec-wait-0.0.9/lib/rspec/wait/handler.rb
logstash-output-scalyr-0.1.20.beta vendor/bundle/jruby/2.5.0/gems/rspec-wait-0.0.9/lib/rspec/wait/handler.rb
logstash-output-scalyr-0.1.19.beta vendor/bundle/jruby/2.5.0/gems/rspec-wait-0.0.9/lib/rspec/wait/handler.rb
logstash-output-scalyr-0.1.18.beta vendor/bundle/jruby/2.5.0/gems/rspec-wait-0.0.9/lib/rspec/wait/handler.rb
logstash-output-scalyr-0.1.17.beta vendor/bundle/jruby/2.5.0/gems/rspec-wait-0.0.9/lib/rspec/wait/handler.rb
logstash-output-scalyr-0.1.16.beta vendor/bundle/jruby/2.5.0/gems/rspec-wait-0.0.9/lib/rspec/wait/handler.rb
logstash-output-scalyr-0.1.15.beta vendor/bundle/jruby/2.5.0/gems/rspec-wait-0.0.9/lib/rspec/wait/handler.rb
logstash-output-scalyr-0.1.14.beta vendor/bundle/jruby/2.5.0/gems/rspec-wait-0.0.9/lib/rspec/wait/handler.rb
logstash-output-scalyr-0.1.13 vendor/bundle/jruby/2.5.0/gems/rspec-wait-0.0.9/lib/rspec/wait/handler.rb
logstash-output-scalyr-0.1.12 vendor/bundle/jruby/2.5.0/gems/rspec-wait-0.0.9/lib/rspec/wait/handler.rb
logstash-output-scalyr-0.1.11.beta vendor/bundle/jruby/2.5.0/gems/rspec-wait-0.0.9/lib/rspec/wait/handler.rb
logstash-output-scalyr-0.1.10.beta vendor/bundle/jruby/2.5.0/gems/rspec-wait-0.0.9/lib/rspec/wait/handler.rb