123456789_123456789_123456789_123456789_123456789_

Class: Capybara::Helpers::Timer Private

Relationships & Source Files
Inherits: Object
Defined in: lib/capybara/helpers.rb

Class Attribute Summary

Class Method Summary

Constructor Details

.new(expire_in) (private)

This method is for internal use only.
[ GitHub ]

  
# File 'lib/capybara/helpers.rb', line 103

def initialize(expire_in)
  @start = current
  @expire_in = expire_in
end

Class Attribute Details

.expired?Boolean (readonly, mod_func)

[ GitHub ]

  
# File 'lib/capybara/helpers.rb', line 108

def expired?
  if stalled?
    raise Capybara::FrozenInTime, 'Time appears to be frozen. Capybara does not work with libraries which freeze time, consider using time travelling instead'
  end

  current - @start >= @expire_in
end

.stalled?Boolean (readonly, mod_func)

[ GitHub ]

  
# File 'lib/capybara/helpers.rb', line 116

def stalled?
  @start == current
end

Class Method Details

.current (private, mod_func)

[ GitHub ]

  
# File 'lib/capybara/helpers.rb', line 122

def current
  Capybara::Helpers.monotonic_time
end

.initialize(expire_in) (mod_func)

[ GitHub ]

  
# File 'lib/capybara/helpers.rb', line 103

def initialize(expire_in)
  @start = current
  @expire_in = expire_in
end