Sha256: d0f1c2be18e00df3b380fb9af3775d926d74ac964ecf28435790af89a726410d

Contents?: true

Size: 1.27 KB

Versions: 38

Compression:

Stored size: 1.27 KB

Contents

# encoding: utf-8

module RSpec
  module Wait
    module Handler
      def handle_matcher(target, *args, &block)
        # there is a similar patch in the rspec-wait repo since Nov, 19 2017
        # it does not look like the author is interested in the change.
        # - do not use Ruby Timeout
        count = RSpec.configuration.wait_timeout.fdiv(RSpec.configuration.wait_delay).ceil
        failure = nil
        count.times do
          begin
            actual = target.respond_to?(:call) ? target.call : target
            super(actual, *args, &block)
            failure = nil
          rescue RSpec::Expectations::ExpectationNotMetError => failure
            sleep RSpec.configuration.wait_delay
          end
          break if failure.nil?
        end
        raise failure unless failure.nil?
      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

RSPEC_WAIT_HANDLER_PATCHED = true

Version data entries

38 entries across 38 versions & 2 rubygems

Version Path
logstash-input-file-4.4.6 spec/helpers/rspec_wait_handler_helper.rb
logstash-input-file-4.4.5 spec/helpers/rspec_wait_handler_helper.rb
logstash-filter-translate-3.4.2 spec/support/rspec_wait_handler_helper.rb
logstash-filter-translate-3.4.1 spec/support/rspec_wait_handler_helper.rb
logstash-input-file-4.4.4 spec/helpers/rspec_wait_handler_helper.rb
logstash-filter-translate-3.4.0 spec/support/rspec_wait_handler_helper.rb
logstash-filter-translate-3.3.1 spec/support/rspec_wait_handler_helper.rb
logstash-input-file-4.4.3 spec/helpers/rspec_wait_handler_helper.rb
logstash-input-file-4.4.2 spec/helpers/rspec_wait_handler_helper.rb
logstash-input-file-4.4.1 spec/helpers/rspec_wait_handler_helper.rb
logstash-input-file-4.4.0 spec/helpers/rspec_wait_handler_helper.rb
logstash-filter-translate-3.3.0 spec/support/rspec_wait_handler_helper.rb
logstash-input-file-4.3.1 spec/helpers/rspec_wait_handler_helper.rb
logstash-input-file-4.3.0 spec/helpers/rspec_wait_handler_helper.rb
logstash-input-file-4.2.4 spec/helpers/rspec_wait_handler_helper.rb
logstash-input-file-4.2.3 spec/helpers/rspec_wait_handler_helper.rb
logstash-input-file-4.2.2 spec/helpers/rspec_wait_handler_helper.rb
logstash-input-file-4.2.1 spec/helpers/rspec_wait_handler_helper.rb
logstash-input-file-4.2.0 spec/helpers/rspec_wait_handler_helper.rb
logstash-input-file-4.1.18 spec/helpers/rspec_wait_handler_helper.rb