Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should Timecop.travel(nil) raise an exception like Timecop.travel("")? #213

Closed
mottalrd opened this issue Sep 26, 2017 · 1 comment · Fixed by #369
Closed

Should Timecop.travel(nil) raise an exception like Timecop.travel("")? #213

mottalrd opened this issue Sep 26, 2017 · 1 comment · Fixed by #369

Comments

@mottalrd
Copy link

mottalrd commented Sep 26, 2017

Hello, I find this behavior a bit odd

irb(main):001:0> require 'timecop'
=> true
irb(main):002:0> Timecop.travel(nil) do end
=> nil
irb(main):003:0> Timecop.travel("") do end
ArgumentError: no time information in ""
	from /Users/motta/.rbenv/versions/2.3.1/lib/ruby/2.3.0/time.rb:254:in `make_time'

shouldn't Timecop.travel(nil) behave in the same way as Timecop.travel("")?
What's the rationale for this choice?

I got bitten by this recently :)

@andyjdavis
Copy link
Contributor

andyjdavis commented Nov 19, 2021

I have raised a PR containing test to confirm the empty string behaviour. #369

I believe passing in nil is valid as there is a default. Now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants