Sha256: c94f504a0f01f480129a6e6f7ad3c4ce722b620da22baa5719bd9cfbede916be

Contents?: true

Size: 806 Bytes

Versions: 7

Compression:

Stored size: 806 Bytes

Contents

require 'spec_helper'

describe RRule::ByMonthDay do
  let(:context) do
    RRule::Context.new(
        { freq: 'MONTHLY', count: 4 },
        Time.parse('Wed Jan  1 00:00:00 PST 1997'),
        'America/Los_Angeles'
    )
  end

  subject { described_class.new([3, -3], context).reject?(date.yday - 1) }

  before(:each) { context.rebuild(1997, 1) }

  describe '#reject?' do
    context 'for the third day of the month' do
      let(:date) { Date.new(1997, 1, 3) }

      it { is_expected.to be false }
    end

    context 'for the fourth day of the month' do
      let(:date) { Date.new(1997, 1, 4) }

      it { is_expected.to be true }
    end

    context 'for the third-to-last day of the month' do
      let(:date) { Date.new(1997, 1, 29) }

      it { is_expected.to be false }
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rrule-0.4.1 spec/filters/by_month_day_spec.rb
rrule-0.4.0 spec/filters/by_month_day_spec.rb
rrule-0.3.1 spec/filters/by_month_day_spec.rb
rrule-0.3.0 spec/filters/by_month_day_spec.rb
rrule-0.2.1 spec/filters/by_month_day_spec.rb
rrule-0.1.1 spec/filters/by_month_day_spec.rb
rrule-0.1.0 spec/filters/by_month_day_spec.rb