This repository has been archived by the owner on Apr 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 472
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed the namespace and team name clashes
Currently we have a problem when a user is removed and added back to Portus. The team and namespace associated with that user are not removed. So, when an admin tries to create a user or an user tries to create an account, an error mentioning that there's already a namespace with that username is shown. With this patch we avoid that by adding an incremental number to the end of the name. For example, if username is "brian" and there's already a namespace/team with that name, "brian0" namespace and team will be created instead. If "brian" gets removed again, next time it will be "brian1" for both namespace and team. Remembering that we should remove this once we implement the namespace/team removal.
- Loading branch information
1 parent
9f8150f
commit eec31da
Showing
9 changed files
with
120 additions
and
65 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
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
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
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
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 |
---|---|---|
|
@@ -10,6 +10,43 @@ | |
visit admin_users_path | ||
end | ||
|
||
describe "create users", js: true do | ||
scenario "admin creates a user" do | ||
visit new_admin_user_path | ||
|
||
fill_in "Username", with: "username" | ||
fill_in "Email", with: "[email protected]" | ||
fill_in "user[password]", with: "password123" | ||
fill_in "Password confirmation", with: "password123" | ||
|
||
click_button "Create" | ||
|
||
expect(page).to have_current_path(admin_users_path) | ||
expect(page).to have_content("User 'username' was created successfully") | ||
end | ||
|
||
scenario "admin adds back a removed user" do | ||
expect(page).to have_css("#user_#{user.id}") | ||
|
||
find("#user_#{user.id} .remove-btn").click | ||
find("#user_#{user.id} .btn-confirm-remove").click | ||
|
||
expect(page).to have_content("User '#{user.username}' was removed successfully") | ||
|
||
visit new_admin_user_path | ||
|
||
fill_in "Username", with: user.username | ||
fill_in "Email", with: user.email | ||
fill_in "user[password]", with: "password123" | ||
fill_in "Password confirmation", with: "password123" | ||
|
||
click_button "Create" | ||
|
||
expect(page).to have_current_path(admin_users_path) | ||
expect(page).to have_content("User '#{user.username}' was created successfully") | ||
end | ||
end | ||
|
||
describe "remove users" do | ||
scenario "allows the admin to remove other users", js: true do | ||
expect(page).to have_css("#user_#{user.id}") | ||
|
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
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
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
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