summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-07-02 07:46:38 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-07-02 07:46:38 +0000
commit482bbde6e25620b340e28423c08e3cee941c438b (patch)
tree3b9b9f80eea65607206cf04e7d57e4af329a6ee9 /spec
parentb53114dd99aeb4c0696c8cd7f013c2bf850747dc (diff)
time.c: [DOC] Time#localtime
* time.c: state that Time#localtime does nothing when nothing changes. [ruby-core:87675] [Bug #14880] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec')
-rw-r--r--spec/ruby/core/time/localtime_spec.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/ruby/core/time/localtime_spec.rb b/spec/ruby/core/time/localtime_spec.rb
index 56c9d37bc8..5592150ca2 100644
--- a/spec/ruby/core/time/localtime_spec.rb
+++ b/spec/ruby/core/time/localtime_spec.rb
@@ -90,6 +90,19 @@ describe "Time#localtime" do
t.utc_offset.should == -18000
end
+
+ it "does nothing if already in a local time zone" do
+ time = with_timezone("America/New_York") do
+ break Time.new(2005, 2, 27, 22, 50, 0)
+ end
+ zone = time.zone
+
+ with_timezone("Europe/Amsterdam") do
+ time.localtime
+ end
+
+ time.zone.should == zone
+ end
end
describe "with an argument that responds to #to_str" do