Skip to content

Commit

Permalink
More consistent business calendar tests
Browse files Browse the repository at this point in the history
  • Loading branch information
excid3 committed Sep 15, 2023
1 parent 90668d2 commit a4835bd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/dummy/app/calendars/business_week_calendar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ class BusinessWeekCalendar < SimpleCalendar::Calendar
private

def date_range
beginning = start_date.beginning_of_week + 1.day
ending = start_date.end_of_week - 1.day
beginning = start_date.monday
ending = beginning + 5.days
(beginning..ending).to_a
end
end
2 changes: 2 additions & 0 deletions test/integrations/custom_calendar_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class CustomCalendarIntegrationTest < ActionDispatch::IntegrationTest

test "calendar render two day events" do
event = meetings(:two_day_event)
event.update(start_time: Time.current.monday, end_time: (Time.current.monday + 1.day).end_of_day)
get business_week_meetings_path, params: {start_date: event.start_time.to_date}
assert_select "div.simple-calendar" do
assert_select "div", text: event.name, count: 2
Expand All @@ -23,6 +24,7 @@ class CustomCalendarIntegrationTest < ActionDispatch::IntegrationTest

test "calendar render three day events" do
event = meetings(:three_day_event)
event.update(start_time: Time.current.monday, end_time: (Time.current.monday + 2.days).end_of_day)
get business_week_meetings_path, params: {start_date: event.start_time.to_date}
assert_select "div.simple-calendar" do
assert_select "div", text: event.name, count: 3
Expand Down

0 comments on commit a4835bd

Please sign in to comment.