Sha256: 9716acefdba72f7ae1b916c4988de5c454ecaef163aba8fe0c1e8ce7fccface2
Contents?: true
Size: 899 Bytes
Versions: 1
Compression:
Stored size: 899 Bytes
Contents
# frozen_string_literal: true require 'timecop' describe Moments do describe '#difference' do subject { Moments.difference(from, to) } let(:from) { Time.new 2012, 1, 1 } let(:to) { Time.new 2013, 1, 1 } it { is_expected.to be_a Moments::Difference } end describe '#ago' do subject { Moments.ago(from) } before do Timecop.freeze(to) end after do Timecop.return end let(:from) { Time.utc 2010, 1, 1, 0, 0, 0 } let(:to) { Time.utc 2016, 6, 5, 3, 2, 1 } it { is_expected.to be_a Moments::Difference } context '#to_hash' do subject { Moments.ago(from).to_hash } let (:expected_result) do { years: 6, months: 5, days: 4, hours: 3, minutes: 2, seconds: 1 } end it { is_expected.to eq expected_result} end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
moments-0.3.0 | spec/lib/moments_spec.rb |