-
-
Notifications
You must be signed in to change notification settings - Fork 264
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for deleting a Team after inviting someone
- Loading branch information
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -184,5 +184,32 @@ def setup | |
assert_text "You cannot delete the last team you belong to." | ||
end | ||
end | ||
|
||
test "user can delete a team after they have invited someone on a #{device_name}" do | ||
resize_for(display_details) | ||
be_invited_to_sign_up | ||
login_as(@jane, scope: :user) | ||
|
||
# Create another team so we're not deleting the last team. | ||
visit new_account_team_path | ||
fill_in "Name", with: "Another Team" | ||
click_on "Create Team" | ||
assert_text "Team was successfully created." | ||
User.find_by(first_name: "Jane").teams.size | ||
|
||
# Create a new Membership on the original Team by sending an Invitation | ||
visit new_account_team_invitation_path(Team.find_by(name: "Your Team")) | ||
fill_in "Email", with: "[email protected]" | ||
click_on "Create Invitation" | ||
assert_text("Invitation was successfully created.") | ||
|
||
# Delete the Team. | ||
visit edit_account_team_path(Team.find_by(name: "Your Team")) | ||
assert_text "Edit Team Details" | ||
assert_difference "Team.count", -1 do | ||
accept_alert { click_on "Delete Team" } | ||
assert_text "Team was successfully destroyed." | ||
end | ||
end | ||
end | ||
end |