-
-
Notifications
You must be signed in to change notification settings - Fork 515
Fix race conditions in spec/system/all_casa_admins/ #6722
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -52,8 +52,8 @@ | |
| fill_in "Address", with: "123 Main St" | ||
| click_on "Create CASA Organization" | ||
| expect(page).to have_text "CASA Organization was successfully created." | ||
| organization = CasaOrg.find_by(name: "Cool Org Name") | ||
| expect(page).to have_current_path "/all_casa_admins/casa_orgs/#{organization.id}", ignore_query: true | ||
| expect(page).to have_text "Cool Org Name" | ||
| expect(page).to have_current_path(%r{/all_casa_admins/casa_orgs/\d+}, ignore_query: true) | ||
| expect(page).to have_content "Administrators" | ||
| expect(page).to have_content "Details" | ||
| expect(page).to have_content "Number of admins: 0" | ||
|
|
@@ -131,9 +131,16 @@ | |
|
|
||
| it "admin invitations expire" do | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The only way to create an all casa admin is via direct db access. Can you convert this test into a system test by having the user click on the invitation links?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Converted to a system test that visits the invitation acceptance link via accept_all_casa_admin_invitation_path. It verifies that the "Set my password" form loads within 1 week, and |
||
| all_casa_admin = AllCasaAdmin.invite!(email: "valid@email.com") | ||
| raw_token = all_casa_admin.raw_invitation_token | ||
|
|
||
| # Invitation is valid within 1 week | ||
| travel 2.days | ||
| expect(all_casa_admin.valid_invitation?).to be true | ||
| visit accept_all_casa_admin_invitation_path(invitation_token: raw_token) | ||
| expect(page).to have_text "Set my password" | ||
|
|
||
| # Invitation expires after 1 week | ||
| travel 8.days | ||
| expect(all_casa_admin.valid_invitation?).to be false | ||
| visit accept_all_casa_admin_invitation_path(invitation_token: raw_token) | ||
| expect(page).to have_text "The invitation token provided is not valid!" | ||
| end | ||
| end | ||
Uh oh!
There was an error while loading. Please reload this page.