Skip to content

Commit 4274abb

Browse files
authored
Merge pull request #6352 from alancovarrubias/6336_test_overhaul
fix race condition in casa_admins/edit_spec.rb
2 parents 7509b2f + 63956b8 commit 4274abb

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

spec/system/casa_admins/edit_spec.rb

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
it "can successfully edit user display name and phone number" do
1010
expected_display_name = "Root Admin"
1111
expected_phone_number = "+14398761234"
12-
expected_date_of_birth = "1997/04/16"
12+
expected_date_of_birth = "1997-04-16"
1313

1414
visit edit_casa_admin_path(admin)
1515

@@ -20,14 +20,11 @@
2020

2121
click_on "Submit"
2222

23-
admin.reload
24-
2523
expect(page).to have_text "Casa Admin was successfully updated."
26-
27-
expect(admin.display_name).to eq expected_display_name
28-
expect(admin.phone_number).to eq expected_phone_number
29-
expect(admin.date_of_birth.strftime("%Y/%m/%d")).to eq expected_date_of_birth
30-
expect(admin.monthly_learning_hours_report).to be_truthy
24+
expect(page).to have_field "Display name", with: expected_display_name
25+
expect(page).to have_field "Phone number", with: expected_phone_number
26+
expect(page).to have_field "Date of birth", with: expected_date_of_birth
27+
expect(page).to have_checked_field("Receive Monthly Learning Hours Report")
3128
end
3229
end
3330

@@ -49,15 +46,16 @@
4946

5047
expect(page).to have_text "Admin was successfully updated. Confirmation Email Sent."
5148
expect(page).to have_field("Email", with: @old_email)
49+
admin.reload
5250
expect(admin.unconfirmed_email).to eq("new_admin_email@example.com")
5351
end
5452

5553
it "succesfully updates the user email once the user confirms the changes" do
5654
admin.confirm
57-
admin.reload
5855
visit edit_casa_admin_path(admin)
5956

6057
expect(page).to have_field("Email", with: "new_admin_email@example.com")
58+
admin.reload
6159
expect(admin.old_emails).to eq([@old_email])
6260
end
6361
end

0 commit comments

Comments
 (0)