mirror of
https://github.com/discourse/discourse.git
synced 2025-01-31 14:03:02 +08:00
Use expect change for groups_controller_spec.rb
This commit is contained in:
parent
dffd8baa91
commit
7803a06e50
|
@ -200,19 +200,22 @@ describe GroupsController do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "removes by id" do
|
it "removes by id" do
|
||||||
xhr :delete, :remove_member, id: group.id, user_id: user.id
|
expect do
|
||||||
|
xhr :delete, :remove_member, id: group.id, user_id: user.id
|
||||||
|
|
||||||
expect(response).to be_success
|
expect(response).to be_success
|
||||||
group.reload
|
group.reload
|
||||||
expect(group.users.count).to eq(0)
|
end.to change{group.users.count}.from(1).to(0)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "removes by username" do
|
it "removes by username" do
|
||||||
xhr :delete, :remove_member, id: group.id, username: user.username
|
expect do
|
||||||
|
xhr :delete, :remove_member, id: group.id, username: user.username
|
||||||
|
|
||||||
expect(response).to be_success
|
expect(response).to be_success
|
||||||
group.reload
|
group.reload
|
||||||
expect(group.users.count).to eq(0)
|
|
||||||
|
end.to change{group.users.count}.from(1).to(0)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "removes user.primary_group_id when user is removed from group" do
|
it "removes user.primary_group_id when user is removed from group" do
|
||||||
|
@ -226,10 +229,11 @@ describe GroupsController do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "removes by user_email" do
|
it "removes by user_email" do
|
||||||
xhr :delete, :remove_member, id: group.id, user_email: user.email
|
expect do
|
||||||
expect(response).to be_success
|
xhr :delete, :remove_member, id: group.id, user_email: user.email
|
||||||
group.reload
|
expect(response).to be_success
|
||||||
expect(group.users.count).to eq(0)
|
group.reload
|
||||||
|
end.to change{group.users.count}.from(1).to(0)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user