Sha256: 627475c8b66bb5b63b7e573ac9ec7f81cc4cb2b55b71bd442039179948cda520
Contents?: true
Size: 1.09 KB
Versions: 3
Compression:
Stored size: 1.09 KB
Contents
# frozen_string_literal: true require_relative '../spec_helper' describe Time do context "beginning_of_hour" do Time.zone = 'Pacific Time (US & Canada)' [ Time.now, Time.zone.now, Time.local(2009), Time.local(2009,3,4,5), Time.local(2001,12,31,23,59), Time.local(1970,1,1) ].each_with_index do |time, index| it "give back a time with no minutes, seconds, or msec: #{time} (#{index})" do t = time.beginning_of_hour expect(time.year).to eq(t.year) expect(time.month).to eq(t.month) expect(time.day).to eq(t.day) expect(time.hour).to eq(t.hour) expect(t.min).to eq(0) expect(t.sec).to eq(0) expect(t.usec).to eq(0) end end end context "end_of_day_whole_sec" do it "return the end of day with whole_sec" do t = Time.now end_of_day = t.end_of_day end_whole_sec = t.end_of_day_whole_sec expect(end_whole_sec.usec).to eq(0.0) expect(end_whole_sec.to_i).to eq(end_of_day.to_i) expect(end_whole_sec.sec).to eq(end_of_day.sec) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
invoca-utils-0.6.0 | spec/unit/time_calculations_spec.rb |
invoca-utils-0.5.1 | spec/unit/time_calculations_spec.rb |
invoca-utils-0.5.0 | spec/unit/time_calculations_spec.rb |