spec
spec copied to clipboard
Ruby 3.1: Add specs for `Time#new` `in` keyword
Issue
Change
This pull request covers the spec below.
[ ] Time.new now accepts optional
in:keyword argument for the timezone, as well asTime.atandTime.now, so that is now you can omit minor arguments toTime.new. [Feature #17485]Time.new(2021, 12, 25, in: "+07:00") #=> 2021-12-25 00:00:00 +0700At the same time, time component strings are converted to integers more strictly now.
Time.new(2021, 12, 25, "+07:30") #=> invalid value for Integer(): "+07:30" (ArgumentError)Ruby 3.0 or earlier returned probably unexpected result
2021-12-25 07:00:00, not2021-12-25 07:30:00nor2021-12-25 00:00:00 +07:30.
I used test cases for Time.at as a reference.
Thank you, could you also add specs for Time.at(..., in:) and Time.now(in: ) since that's part of the same item?
Thank you too!