Fix flaky system specs and upgrade Rails to 8.1.3.1 - #5653
Open
rodrigovirgilio wants to merge 2 commits into
Open
Fix flaky system specs and upgrade Rails to 8.1.3.1#5653rodrigovirgilio wants to merge 2 commits into
rodrigovirgilio wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Two unrelated pieces of CI hardening in a single branch: fixes for intermittently failing system specs, and an upgrade of Rails to a supported release so Brakeman CI stops failing.
Flaky system specs
spec/system/account_request_system_spec.rbThe test asserted
expect { click_button "Submit" }.to change(AccountRequest, :count).by(1), but the count was read before the async form submission had been processed by the server, so the change was reported as0. The assertion now clicks the button, waits for the redirect (Request Received!), and only then asserts the record count.spec/system/partner_system_spec.rb(partner group "deadline and reminder form" shared examples)click_on "Edit"could run before the Groups tab-pane was actually displayed, raisingCapybara::ElementNotFound. The precedinghas_content?check was a false positive because the group name also appears in the (visible) Partners tab. The wait and click are now scoped withwithin "#nav-partner-groups", so the test waits for the tab to be shown before interacting with it.Rails upgrade
Brakeman CI began failing after the bump to Brakeman 8.0.5: the
EOLRailscheck flags Rails 8.0.2.1 because support for the 8.0.x line ends on 2026-10-07 (within Brakeman'"'"'s 60-day warning window). Upgrading to the latest stable patch, Rails 8.1.3.1, resolves the warning — the report goes back to 0 warnings with the existingconfig/brakeman.ignoreuntouched.The upgrade surfaced a handful of spec regressions caused by Rails 8.1 behavior changes, all fixed:
spec/requests/distributions_requests_spec.rb— a multiparameter date assignment usednilfor the missing day component, which now raisesNoMethodError: undefined method '"'"'empty?'"'"' for nil(known Rails issue, Gracefully handlenilduring multi-parameter assignment rails/rails#57271). A real browser submits an empty string, so the spec now uses"", which both versions handle identically.spec/services/calendar_service_spec.rb— Rails 8.1 added a time zone toActiveSupport::TimeZone::MAPPING(America/Asuncion), so the expected count is updated from 151 to 152.spec/requests/requests_requests_spec.rb— the "does not display the Cancel button" spec selected the first<button>on the page, which is now Turbo'"'"'s "Copy as text" button. The selector now targets the actual Cancel form (button[data-disable-with="Please wait..."]/input[value="Cancel"]).Type of change
How Has This Been Tested?
Full suite:
bundle exec rspec→ 2874 examples, 3 failures. The 3 failures are the pre-existing local-only county-ordering specs (export_partners_csv_service_spec.rb,partners_requests_spec.rb:197) caused by the local PostgresCcollation; they pass in CI onpostgres:12.3. No failures remain from the Rails upgrade.bundle exec rspec spec/system/account_request_system_spec.rb→ 4 examples, 0 failures (repeated runs)bundle exec rspec spec/system/partner_system_spec.rb→ 47 examples, 0 failuresbundle exec brakeman→ 0 security warningsbundle exec rubocop spec/system/account_request_system_spec.rb spec/system/partner_system_spec.rb→ no offenses