mirror of
https://github.com/we-promise/sure.git
synced 2026-04-19 03:54:08 +00:00
Refactor date validation to DRY and improve test robustness
Co-authored-by: jjmata <187772+jjmata@users.noreply.github.com>
This commit is contained in:
@@ -106,8 +106,9 @@ class ReportsControllerTest < ActionDispatch::IntegrationTest
|
||||
# Should show flash message about invalid date range
|
||||
assert flash[:alert].present?, "Flash alert should be present"
|
||||
assert_match /End date cannot be before start date/, flash[:alert]
|
||||
# Should display the swapped date range
|
||||
assert_select ".text-sm.text-secondary", text: /Showing data from #{Regexp.escape(end_date.strftime("%b %-d, %Y"))} to #{Regexp.escape(start_date.strftime("%b %-d, %Y"))}/
|
||||
# Verify the response body contains the swapped date range in the correct order
|
||||
assert_includes @response.body, end_date.strftime("%b %-d, %Y")
|
||||
assert_includes @response.body, start_date.strftime("%b %-d, %Y")
|
||||
end
|
||||
|
||||
test "spending patterns returns data when expense transactions exist" do
|
||||
|
||||
Reference in New Issue
Block a user