mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Fix warning with Ruby 2.7 on Time.at with keyword arguments
Closes #41375
This commit is contained in:
parent
5d10e8e343
commit
249232f659
2 changed files with 6 additions and 2 deletions
|
@ -42,8 +42,8 @@ class Time
|
|||
|
||||
# Layers additional behavior on Time.at so that ActiveSupport::TimeWithZone and DateTime
|
||||
# instances can be used when called with a single argument
|
||||
def at_with_coercion(*args)
|
||||
return at_without_coercion(*args) if args.size != 1
|
||||
def at_with_coercion(*args, **kwargs)
|
||||
return at_without_coercion(*args, **kwargs) if args.size != 1 || !kwargs.empty?
|
||||
|
||||
# Time.at can be called with a time or numerical value
|
||||
time_or_number = args.first
|
||||
|
|
|
@ -919,6 +919,10 @@ class TimeExtCalculationsTest < ActiveSupport::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
def test_at_with_in_option
|
||||
assert_equal Time.new(1970, 1, 1, 0, 42, 17, "-08:00"), Time.at(31337, in: -28800)
|
||||
end
|
||||
|
||||
def test_at_with_time_with_zone_returns_local_time
|
||||
with_env_tz "US/Eastern" do
|
||||
twz = ActiveSupport::TimeWithZone.new(Time.utc(2000, 1, 1, 0, 0, 0), ActiveSupport::TimeZone["London"])
|
||||
|
|
Loading…
Reference in a new issue