mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
87aebecdc2
`time_with_zone.zone.should == (time_with_zone - 60*60).zone` fails when the time is immediately before the change of summer time. https://rubyci.org/logs/rubyci.s3.amazonaws.com/unstable11s/ruby-master/log/20200328T232504Z.fail.html.gz ``` 1) Time#+ preserves time zone FAILED Expected "CET" == "CEST" to be truthy but was false ``` It is acceptable as it fails at most twice per year, but it would be good to use near time objects to reduce the possibility.
39 lines
809 B
Ruby
39 lines
809 B
Ruby
require_relative '../../spec_helper'
|
|
require_relative 'fixtures/classes'
|
|
|
|
describe "Time#succ" do
|
|
it "returns a new time one second later than time" do
|
|
suppress_warning {
|
|
@result = Time.at(100).succ
|
|
}
|
|
|
|
@result.should == Time.at(101)
|
|
end
|
|
|
|
it "returns a new instance" do
|
|
time = Time.at(100)
|
|
|
|
suppress_warning {
|
|
@result = time.succ
|
|
}
|
|
|
|
@result.should_not equal time
|
|
end
|
|
|
|
it "is obsolete" do
|
|
-> {
|
|
Time.at(100).succ
|
|
}.should complain(/Time#succ is obsolete/)
|
|
end
|
|
|
|
ruby_version_is "2.6" do
|
|
context "zone is a timezone object" do
|
|
it "preserves time zone" do
|
|
zone = TimeSpecs::Timezone.new(offset: (5*3600+30*60))
|
|
time = Time.new(2012, 1, 1, 12, 0, 0, zone) - 1
|
|
|
|
time.zone.should == zone
|
|
end
|
|
end
|
|
end
|
|
end
|