Skip to content

Commit

Permalink
Revert "Update dates helper (#828)"
Browse files Browse the repository at this point in the history
This reverts commit 8aa2b59.
  • Loading branch information
jagthedrummer committed Aug 11, 2023
1 parent 0ab4c52 commit ca91ccb
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions test/system/dates_helper_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,20 @@ class DatesHelperTest < ApplicationSystemTestCase
click_on "Back"

# Assert today's date is displayed correctly.
assert_text I18n.l(time, format: :default)
assert page.has_text? "Today at #{time.strftime("%l:%M %p").strip}"

# Assert yesterday's date is displayed correctly.
travel_to time + 1.day
visit current_url # Refresh the page
assert_text I18n.l(time, format: :default)
assert page.has_text? "Yesterday at #{time.strftime("%l:%M %p").strip}"

# Assert the month and day is shown for anything before then.
travel_to time + 2.days
visit current_url

# We have to assert these two things separately so it doesn't fail on the last day of the year when the year is present.
assert page.has_text? time.strftime("%B %-d").strip.to_s
assert page.has_text? "at #{time.strftime("%l:%M %p").strip}"

# Create a new record in a different time zone.
Time.zone = "Tokyo"
Expand Down

0 comments on commit ca91ccb

Please sign in to comment.