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
|
||||
|
||||
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
|
||||
group.reload
|
||||
expect(group.users.count).to eq(0)
|
||||
expect(response).to be_success
|
||||
group.reload
|
||||
end.to change{group.users.count}.from(1).to(0)
|
||||
end
|
||||
|
||||
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
|
||||
group.reload
|
||||
expect(group.users.count).to eq(0)
|
||||
expect(response).to be_success
|
||||
group.reload
|
||||
|
||||
end.to change{group.users.count}.from(1).to(0)
|
||||
end
|
||||
|
||||
it "removes user.primary_group_id when user is removed from group" do
|
||||
|
@ -226,10 +229,11 @@ describe GroupsController do
|
|||
end
|
||||
|
||||
it "removes by user_email" do
|
||||
xhr :delete, :remove_member, id: group.id, user_email: user.email
|
||||
expect(response).to be_success
|
||||
group.reload
|
||||
expect(group.users.count).to eq(0)
|
||||
expect do
|
||||
xhr :delete, :remove_member, id: group.id, user_email: user.email
|
||||
expect(response).to be_success
|
||||
group.reload
|
||||
end.to change{group.users.count}.from(1).to(0)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue