Sha256: e5ce890c6fc2e6b275ef62d06ebb91b190b38b875918c6e0e955fefb1488be70

Contents?: true

Size: 895 Bytes

Versions: 2

Compression:

Stored size: 895 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

2 entries across 2 versions & 1 rubygems

Version Path
simple_calendar-2.4.3 spec/calendars/month_calendar_spec.rb
simple_calendar-2.4.2 spec/calendars/month_calendar_spec.rb