Skip to content

Commit

Permalink
Add test for deleting a Team after inviting someone
Browse files Browse the repository at this point in the history
  • Loading branch information
gazayas committed Sep 22, 2023
1 parent 873d357 commit c4fc096
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/system/teams_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit c4fc096

Please sign in to comment.