Top Level Namespace

Defined Under Namespace

Modules: Carnivore Classes: Hash, MessageStore

Constant Summary

Smash =
Carnivore::Utils::Smash

Instance Method Summary (collapse)

Instance Method Details

- (Numeric) source_wait(name = 'wait')

Simple waiter method to stall testing

Parameters:

  • name (String, Symbol) (defaults to: 'wait')

    fetch wait time from environment variable

Returns:

  • (Numeric)

    seconds sleeping



25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/carnivore/spec_helper.rb', line 25

def source_wait(name='wait')
  total = ENV.fetch("CARNIVORE_SOURCE_#{name.to_s.upcase}", 1.0).to_f
  if(block_given?)
    elapsed = 0.0
    until(yield || elapsed >= total)
      sleep(0.1)
      elapsed += 0.1
    end
    elapsed
  else
    sleep(total)
    total
  end
end