Module: Soaspec::ExchangeRepeater

Included in:
Exchange
Defined in:
lib/soaspec/exchange/exchange_repeater.rb

Overview

Ways of repeating an exchange to reach a desired outcome

Instance Method Summary collapse

Instance Method Details

#until(opts = {}, &script) ⇒ Exchange

Wait until the passed block returns true

Parameters:

  • opts (Hash) (defaults to: {})

    Options for this instance

Options Hash (opts):

  • :timeout (Numeric) — default: 5

    Seconds to wait before timing out.

  • :interval (Numeric) — default: 0.2

    Seconds to sleep between polls.

  • :message (String)

    Exception message if timed out.

  • :ignore (Array, Exception)

    Exceptions to ignore while polling (default: Error::NoSuchElementError)

Returns:

  • (Exchange)

    Returns itself so operations can be done on the exchange after it’s done waiting



13
14
15
16
17
18
19
# File 'lib/soaspec/exchange/exchange_repeater.rb', line 13

def until(opts = {}, &script)
  Soaspec::Wait.until(opts) do
    @response = nil # Reset response so it can be made repeatedly
    instance_eval(&script)
  end
  self
end