Sha256: 101d475c3d22b3d4a906728f683b1d8741fc36111d481d3aee04e52c657ca0ed

Contents?: true

Size: 893 Bytes

Versions: 1

Compression:

Stored size: 893 Bytes

Contents

require 'spec_helper'
require 'action_controller'
require 'simple_calendar/calendar'
require 'simple_calendar/month_calendar'
require 'support/view_context'

describe SimpleCalendar::MonthCalendar do
  describe '#date_range' do
    it 'renders a full calendar month' do
      today = Date.today
      calendar = SimpleCalendar::MonthCalendar.new(ViewContext.new, start_date: Date.today)

      expect(calendar.date_range.min).to be < today.beginning_of_month
      expect(calendar.date_range.max).to be > today.end_of_month
    end

    it 'render the days of next and previous months on the edges of the calendar' do
      month = Date.new(2018, 8, 1)
      calendar = SimpleCalendar::MonthCalendar.new(ViewContext.new, start_date: month)

      expect(calendar.date_range.first).to eq Date.new(2018, 7, 30)
      expect(calendar.date_range.last).to eq Date.new(2018, 9, 2)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
simple_calendar-2.3.0 spec/calendars/month_calendar_spec.rb