timecop
timecop copied to clipboard
Raise an exception if this arg looks like a timestamp
In the case where someone calls Timecop.freeze(some_timestamp), they probably meant to freeze at the provided timestamp, instead of that many seconds in the future.
I don't think I'd want to ship this PR, but can massage this PR into whichever of these you prefer:
if arg > k, using that timestampif arg > k, materializing an exception that can be caught- Something else?
k
I chose 1300000000 somewhat arbitrarily. Happy to change it to something like 1000000000 instead.
Tests
Happy to write tests once you let me know which outcome you prefer.
they probably meant ...
I chose 1300000000 somewhat arbitrarily ...
:-1: It's a nice idea, but I don't think this should be merged...
This patch may be useful for your specific use case, but I don't think the gem should be "cluttered" with this hardcoded value, or even as a configuration option.
If you passed a timestamp into the method, then that's a bug in your code; not a bug in TimeCop.