Sha256: bb82220aec077f62a0c955a6d47ef358c137d7ef9df95269635a5f76bd570b05

Contents?: true

Size: 979 Bytes

Versions: 18

Compression:

Stored size: 979 Bytes

Contents

module TimeBoss
  class Calendar
    describe Quarter do
      let(:calendar) { instance_double(TimeBoss::Calendar) }
      let(:start_date) { Date.parse('2019-09-30') }
      let(:end_date) { Date.parse('2019-12-29') }
      let(:subject) { described_class.new(calendar, 2019, 4, start_date, end_date) }

      it 'knows its stuff' do
        expect(subject.name).to eq '2019Q4'
        expect(subject.start_date).to eq start_date
        expect(subject.end_date).to eq end_date
        expect(subject.to_range).to eq start_date..end_date
      end

      it 'can stringify itself' do
        expect(subject.to_s).to include('2019Q4', start_date.to_s, end_date.to_s)
      end

      describe '#current?' do
        it 'knows when it is' do
          allow(Date).to receive(:today).and_return start_date
          expect(subject).to be_current
        end

        it 'knows when it is not' do
          expect(subject).not_to be_current
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
timeboss-1.0.1 spec/calendar/quarter_spec.rb
timeboss-1.0.0 spec/calendar/quarter_spec.rb
timeboss-0.3.1 spec/calendar/quarter_spec.rb
timeboss-0.3.0 spec/calendar/quarter_spec.rb
timeboss-0.2.5 spec/calendar/quarter_spec.rb
timeboss-0.2.4 spec/calendar/quarter_spec.rb
timeboss-0.2.3 spec/calendar/quarter_spec.rb
timeboss-0.2.2 spec/calendar/quarter_spec.rb
timeboss-0.2.1 spec/calendar/quarter_spec.rb
timeboss-0.2.0 spec/calendar/quarter_spec.rb
timeboss-0.1.1 spec/calendar/quarter_spec.rb
timeboss-0.1.0 spec/calendar/quarter_spec.rb
timeboss-0.0.10 spec/calendar/quarter_spec.rb
timeboss-0.0.9 spec/calendar/quarter_spec.rb
timeboss-0.0.8 spec/calendar/quarter_spec.rb
timeboss-0.0.7 spec/calendar/quarter_spec.rb
timeboss-0.0.6 spec/calendar/quarter_spec.rb
timeboss-0.0.5 spec/calendar/quarter_spec.rb