Class: GollyUtils::Testing::Helpers::WithinTime
- Defined in:
- lib/golly-utils/testing/rspec/within_time.rb
Overview
Instance Method Summary collapse
- #hours(&block) ⇒ Object (also: #hour, #hr, #hrs)
-
#initialize(timeout, sleep_time = 0.1) ⇒ WithinTime
constructor
A new instance of WithinTime.
- #minutes(&block) ⇒ Object (also: #minute, #min)
- #ms(&block) ⇒ Object (also: #msec)
- #seconds(&block) ⇒ Object (also: #second, #sec)
Constructor Details
#initialize(timeout, sleep_time = 0.1) ⇒ WithinTime
Returns a new instance of WithinTime.
26 27 28 29 30 31 32 33 34 |
# File 'lib/golly-utils/testing/rspec/within_time.rb', line 26 def initialize(timeout, sleep_time=0.1) timeout= timeout.to_f raise unless timeout > 0 @timeout= timeout sleep_time= sleep_time.to_f raise unless sleep_time > 0 @sleep_time= sleep_time end |
Instance Method Details
#hours(&block) ⇒ Object Also known as: hour, hr, hrs
38 |
# File 'lib/golly-utils/testing/rspec/within_time.rb', line 38 def hours (&block) run 3600 , block end |
#minutes(&block) ⇒ Object Also known as: minute, min
37 |
# File 'lib/golly-utils/testing/rspec/within_time.rb', line 37 def minutes(&block) run 60 , block end |
#ms(&block) ⇒ Object Also known as: msec
35 |
# File 'lib/golly-utils/testing/rspec/within_time.rb', line 35 def ms (&block) run 0.001, block end |
#seconds(&block) ⇒ Object Also known as: second, sec
36 |
# File 'lib/golly-utils/testing/rspec/within_time.rb', line 36 def seconds(&block) run 1 , block end |