Skip to content

Commit

Permalink
Jeremy/fix breaking date change (#844)
Browse files Browse the repository at this point in the history
* Revert "Update dates helper (#828)"

This reverts commit 8aa2b59.

* use assert_text to get better error messages
  • Loading branch information
jagthedrummer authored Aug 14, 2023
1 parent 2d92ff1 commit 869baaa
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_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_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_text time.strftime("%B %-d").strip.to_s
assert_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 869baaa

Please sign in to comment.