Sha256: 7675bbe15976a169ce37a44f95a4c29a73ef8c59face5a8ee1a8a2f016baa765
Contents?: true
Size: 1.02 KB
Versions: 12
Compression:
Stored size: 1.02 KB
Contents
require File.expand_path(File.join(File.dirname(__FILE__), "/../../../../spec_helper.rb")) describe Mongoid::Extensions::Time::Conversions do before do Time.zone = "Eastern Time (US & Canada)" @time = Time.local(1976, 11, 19) end after do Time.zone = nil end describe "#set" do context "when value is a string" do it "converts to a utc time" do Time.set(@time.to_s).utc_offset.should == 0 end end context "when value is a time" do it "converts to a utc time" do Time.set(@time).utc_offset.should == 0 end end context "when value is nil" do it "returns nil" do Time.set(nil).should be_nil end end end describe "#get" do context "when time is provided" do it "returns the local time" do Time.get(@time.dup.utc).utc_offset.should == @time.utc_offset end end context "when time is nil" do it "returns nil" do Time.get(nil).should be_nil end end end end
Version data entries
12 entries across 12 versions & 1 rubygems