mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
FEATURE: Change user groups in bulk via admin
This commit is contained in:
parent
e1d5503053
commit
47e25648df
11 changed files with 143 additions and 0 deletions
|
@ -36,6 +36,26 @@ describe Admin::GroupsController do
|
|||
|
||||
end
|
||||
|
||||
context ".bulk" do
|
||||
it "can assign users to a group by email or username" do
|
||||
group = Fabricate(:group, name: "test", primary_group: true, title: 'WAT')
|
||||
user = Fabricate(:user)
|
||||
user2 = Fabricate(:user)
|
||||
|
||||
xhr :put, :bulk_perform, group_id: group.id, users: [user.username.upcase, user2.email, 'doesnt_exist']
|
||||
|
||||
expect(response).to be_success
|
||||
|
||||
user.reload
|
||||
expect(user.primary_group).to eq(group)
|
||||
expect(user.title).to eq("WAT")
|
||||
|
||||
user2.reload
|
||||
expect(user2.primary_group).to eq(group)
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
context ".create" do
|
||||
|
||||
it "strip spaces on the group name" do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue