Sha256: f3d7eca1dedc6d977ad92c668076c8c6701f85f97f434a00d422ba2c38749324

Contents?: true

Size: 858 Bytes

Versions: 8

Compression:

Stored size: 858 Bytes

Contents

require_relative 'support/spec_helper'
require 'time_distribution/time'
require 'chronic'

include TimeDistribution
using TimeRefinement

describe Time do
  describe '#count_forward_to' do
    it 'counts duration properly when both times are in AM' do
      Chronic.parse('10am').count_forward_to(Chronic.parse('11:30am')).must_equal 1.5.hours
    end
    it 'counts duration properly when both times are in PM' do
      Chronic.parse('10pm').count_forward_to(Chronic.parse('11:30pm')).must_equal 1.5.hours
    end
    it 'counts duration properly when it crosses from AM to PM' do
      Chronic.parse('11am').count_forward_to(Chronic.parse('12:30pm')).must_equal 1.5.hours
    end
    it 'counts duration properly when it crosses from PM to AM' do
      Chronic.parse('11pm').count_forward_to(Chronic.parse('12:30am')).must_equal 1.5.hours
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
time_distribution-2.1.2 spec/time_spec.rb
time_distribution-2.1.1 spec/time_spec.rb
time_distribution-2.1.0 spec/time_spec.rb
time_distribution-2.0.2 spec/time_spec.rb
time_distribution-2.0.1 spec/time_spec.rb
time_distribution-2.0.0 spec/time_spec.rb
time_distribution-1.1.0 spec/time_spec.rb
time_distribution-1.0.0 spec/time_spec.rb