Skip to content

Instantly share code, notes, and snippets.

Created Jul 11, 2011

What would you like to do?

This simple framework allows you to assert things that should happen tomorrow*. For example:

assert_tomorrow { == 2 } # => :passed
                                       # assuming today is Monday (i.e. wday == 1)

Another example shows that the time will never be the same again:

today =
assert_tomorrow { == today } # => :failed

And sometimes we can't event assert something for sure, because my expectation is too complex!

assert_tomorrow { _why is back }      # => :error

Of course, there is a lot room for improvement. You can introduce you own DSL and run tests against your life, for example:

me = Dnnx.instance.clone
assert_tomorrow do 
  future_me = Dnnx.instance 
  future_me.is_better_than me

*I didn't invent a time machine, so you have to wait 1 day for test result.

def assert_tomorrow() sleep(24*60*60); (yield ? :passed : :failed) rescue :error end

This comment has been minimized.

Copy link

jeffkreeftmeijer commented Jul 14, 2011

This is certainly the best way to test if something will happen tomorrow without cheating and using a time machine. Awesome work! ;)


This comment has been minimized.

Copy link

bltavares commented Jul 17, 2011


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.