Class: Test::Unit::TestCase

Inherits:
Object
  • Object
show all
Defined in:
lib/time_warp.rb

Instance Method Summary collapse

Instance Method Details

#pretend_now_is(*args) ⇒ Object

Time warp to the specified time for the duration of the passed block.



9
10
11
12
13
14
15
16
# File 'lib/time_warp.rb', line 9

def pretend_now_is(*args)
  begin
    Time.testing_offset = Time.now - time_from(*args)
    yield
  ensure
    Time.testing_offset = 0
  end
end