Skip to content

Fix race conditions in spec/system/all_casa_admins/#6722

Open
vishaltps wants to merge 1 commit intorubyforgood:mainfrom
vishaltps:fix/6694-race-condition-all-casa-admins
Open

Fix race conditions in spec/system/all_casa_admins/#6722
vishaltps wants to merge 1 commit intorubyforgood:mainfrom
vishaltps:fix/6694-race-condition-all-casa-admins

Conversation

@vishaltps
Copy link

Fixes #6694

Summary

  • Replace all non-webpage expects with page-level assertions in spec/system/all_casa_admins/ to fix race conditions in CI
  • Replace CasaOrg.find_by DB query with regex path match on the page
  • Remove ActionMailer::Base.deliveries checks (email delivery content is not visible on the webpage; existing page assertions already confirm success)
  • Remove CasaAdmin.find_by invitation check (already confirmed by page assertion "New admin created successfully")
  • Remove "admin invitations expire" test (pure model test with zero browser interaction — does not belong in a system spec)
  • Rewrite expect { visit "/flipper" }.to raise_error(ActionController::RoutingError) to check the webpage by temporarily enabling exception rendering

Files checked

All 5 files from the issue checklist were reviewed:

File Result
all_casa_admin_spec.rb Fixed — 5 non-webpage expects replaced/removed
sessions/new_spec.rb Fixed — 1 non-webpage expect rewritten
edit_spec.rb Clean — all expects already check the page
password_change_spec.rb Clean — all expects already check the page
patch_notes/index_spec.rb Clean — all expects already check the page

Follow-up

The "admin invitations expire" test was removed from the system spec. It should be re-added as a model/unit test in spec/models/all_casa_admin_spec.rb (which does not currently exist).

Test plan

  • bundle exec rspec spec/system/all_casa_admins/ — all 17 examples pass, 0 failures

@github-actions github-actions bot added ruby Pull requests that update Ruby code Tests! 🎉💖👏 labels Feb 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ruby Pull requests that update Ruby code Tests! 🎉💖👏

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Race Condition Check: spec/system/all_casa_admins/

1 participant