Module: RSpec::Wait

Defined in:
lib/rspec/wait.rb,
lib/rspec/wait/error.rb,
lib/rspec/wait/proxy.rb,
lib/rspec/wait/target.rb,
lib/rspec/wait/handler.rb

Defined Under Namespace

Modules: Handler Classes: Error, NegativeHandler, PositiveHandler, Proxy, Target, TimeoutError

Class Method Summary collapse

Class Method Details

.wait(timeout = nil, options = {}) ⇒ Object



16
17
18
19
# File 'lib/rspec/wait.rb', line 16

def wait(timeout = nil, options = {})
  options[:timeout] = timeout
  Proxy.new(options)
end

.wait_for(value = Target::UndefinedValue, &block) ⇒ Object



12
13
14
# File 'lib/rspec/wait.rb', line 12

def wait_for(value = Target::UndefinedValue, &block)
  Target.for(value, block)
end

.with_wait(options) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/rspec/wait.rb', line 21

def with_wait(options)
  original_timeout = RSpec.configuration.wait_timeout
  original_delay = RSpec.configuration.wait_delay

  RSpec.configuration.wait_timeout = options[:timeout] if options[:timeout]
  RSpec.configuration.wait_delay = options[:delay] if options[:delay]

  yield
ensure
  RSpec.configuration.wait_timeout = original_timeout
  RSpec.configuration.wait_delay = original_delay
end