Sha256: f77a8981206ed605dd8c7aded1c79ddcf3cc446045c41899ea3e6db80b52e846

Contents?: true

Size: 1000 Bytes

Versions: 4

Compression:

Stored size: 1000 Bytes

Contents

RSpec.describe TimeInterval do
  describe '.parse' do
    context 'iso8601 is a valid time and duration' do
      let(:iso8601) { '2007-03-01T13:00:00Z/P1M' }

      it 'should return a TimeWithDuration' do
        expect(TimeInterval.parse(iso8601)).to be_a TimeWithDuration
      end
    end

    context 'iso8601 is a valid time pair' do
      let(:iso8601) { '2007-03-01T13:00:00Z/2008-05-11T15:30:00Z' }

      it 'should return a TimePair' do
        expect(TimeInterval.parse(iso8601)).to be_a TimePair
      end
    end

    context 'iso8601 is a valid repeating interval' do
      let(:iso8601) { 'R/2007-03-01T13:00:00Z/P1M' }

      it 'should return a RepeatingInterval' do
        expect(TimeInterval.parse(iso8601)).to be_a RepeatingInterval
      end
    end

    context 'iso8601 is not an interval' do
      let(:iso8601) { '2007-03-01T13:00:00Z' }

      it 'should return a RepeatingInterval' do
        expect(TimeInterval.parse(iso8601)).to be_a Time
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
time-interval-0.0.4 spec/lib/time_interval_spec.rb
time-interval-0.0.3 spec/lib/time_interval_spec.rb
time-interval-0.0.2 spec/lib/time_interval_spec.rb
time-interval-0.0.1 spec/lib/time_interval_spec.rb