Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dates helper #828

Merged
merged 4 commits into from
Aug 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions test/system/dates_helper_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,12 @@ class DatesHelperTest < ApplicationSystemTestCase
click_on "Back"

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

# Assert yesterday's date is displayed correctly.
travel_to time + 1.day
visit current_url # Refresh the page
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}"
assert_text I18n.l(time, format: :default)

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