Sha256: be1481d3e7167824a0724858e8a51e6a63ddea6986850b26d5acaae0ae38f7f7

Contents?: true

Size: 872 Bytes

Versions: 2

Compression:

Stored size: 872 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe RegularSchedule do
  describe '#occurances' do
    context 'date range given does not intersect effective date range' do
      it 'should return []' do
        RegularSchedule.new(
          Monthly.new(15),
          Date.new(2000)...Date.new(2001)
        ).occurances(Date.new(2001)..Date.new(2002)).should be_empty
      end
    end

    context 'monthly regularity' do
      context 'date range given overlaps exactly 1 whole month' do
        it 'should return one date on the mday' do
          occurances = RegularSchedule.new(
            Monthly.new(15),
            Date.new(2000)...Date.new(2001)
          ).occurances(Date.new(2000,12)..Date.new(2001))

          occurances.count.should eq(1)
          occurances.first.mday.should eq(15)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
scheduling-0.1.2 spec/schedule/regular_schedule_spec.rb
scheduling-0.1.1 spec/schedule/regular_schedule_spec.rb