Admin users page: filter by username
CI / Test (pull_request) Successful in 33s
Release Drafter / Update release notes draft (pull_request) Successful in 2s

Allow admins to filter the user list/index by username (partial matches
allowed)
This commit is contained in:
2026-08-10 10:36:05 -06:00
parent 9c143bc8d6
commit d58c995230
3 changed files with 36 additions and 1 deletions
+26
View File
@@ -15,6 +15,8 @@ RSpec.describe "Admin: User management", type: :feature do
.and_return({ uid: user.cn, mail: user.email, display_name: "Freddy" })
allow_any_instance_of(LdapManager::FetchAvatar).to receive(:call)
.and_return(nil)
allow_any_instance_of(LdapService).to receive(:search_users)
.and_return([])
login_as admin, :scope => :user
end
@@ -43,6 +45,30 @@ RSpec.describe "Admin: User management", type: :feature do
expect(user.invitations.count).to eq(5)
end
describe "User index page" do
it "lists all users" do
visit admin_users_path
expect(page).to have_link "jimmy"
expect(page).to have_link "alfred"
end
scenario 'Filter users by username' do
visit admin_users_path
fill_in "username", with: "alf"
click_button "Filter"
expect(page).to have_link "alfred"
expect(page).to have_no_link "jimmy"
click_link "Remove filter"
expect(page).to have_link "jimmy"
expect(page).to have_link "alfred"
end
end
scenario 'Remove invitations from account' do
3.times { Invitation.create(user: user) }
expect(user.invitations.count).to eq(3)