aboutsummaryrefslogtreecommitdiffstats
path: root/spec/ruby/core/time/new_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/time/new_spec.rb')
-rw-r--r--spec/ruby/core/time/new_spec.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/ruby/core/time/new_spec.rb b/spec/ruby/core/time/new_spec.rb
index 2bffe839b8..e0218a2572 100644
--- a/spec/ruby/core/time/new_spec.rb
+++ b/spec/ruby/core/time/new_spec.rb
@@ -97,3 +97,16 @@ describe "Time.new with a utc_offset argument" do
lambda { Time.new(2000, 1, 1, 0, 0, 0, 86400) }.should raise_error(ArgumentError)
end
end
+
+ruby_version_is "2.6" do
+ describe "Time.new with a timezone argument" do
+ it "returns a Time correspoinding to UTC time returned by local_to_utc" do
+ zone = mock('timezone')
+ zone.should_receive(:local_to_utc).and_return(Time::TM.new(2000, 1, 1, 6, 30, 0))
+ t = Time.new(2000, 1, 1, 12, 0, 0, zone)
+ t.to_a[0, 6].should == [0, 0, 12, 1, 1, 2000]
+ t.utc_offset.should == 19800
+ t.zone.should == zone
+ end
+ end
+end