summaryrefslogtreecommitdiff
path: root/spec/ruby/core/time/shared/now.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/time/shared/now.rb')
-rw-r--r--spec/ruby/core/time/shared/now.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/ruby/core/time/shared/now.rb b/spec/ruby/core/time/shared/now.rb
index f570aeedd2..c35115fcf4 100644
--- a/spec/ruby/core/time/shared/now.rb
+++ b/spec/ruby/core/time/shared/now.rb
@@ -5,4 +5,16 @@ describe :time_now, shared: true do
TimeSpecs::SubTime.send(@method).should be_an_instance_of(TimeSpecs::SubTime)
TimeSpecs::MethodHolder.send(@method).should be_an_instance_of(Time)
end
+
+ it "sets the current time" do
+ now = TimeSpecs::MethodHolder.send(@method)
+ now.to_f.should be_close(Process.clock_gettime(Process::CLOCK_REALTIME), 10.0)
+ end
+
+ it "uses the local timezone" do
+ with_timezone("PDT", -8) do
+ now = TimeSpecs::MethodHolder.send(@method)
+ now.utc_offset.should == (-8 * 60 * 60)
+ end
+ end
end