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,
lib/rspec/wait/version.rb

Defined Under Namespace

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

Constant Summary collapse

VERSION =
::Gem::Version.new("0.0.10")

Class Method Summary collapse

Class Method Details

.versionObject



5
6
7
# File 'lib/rspec/wait/version.rb', line 5

def self.version
  VERSION
end

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



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

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

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



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

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

.with_wait(options) ⇒ Object



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

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