FEATURE: Allow add group member endpoint to skip invite emails (#29962)

This commit is contained in:
Mark VanLandingham
2024-11-27 11:33:09 -06:00
committed by GitHub
parent b4ef3456d9
commit 8c311dcbd5
2 changed files with 23 additions and 1 deletions

View File

@ -1707,6 +1707,23 @@ RSpec.describe GroupsController do
end
end
it "sends emails with invitations when `skip_emails` param isn't present" do
expect_enqueued_with(job: :invite_email) do
put "/groups/#{group.id}/members.json", params: { emails: "something@gmail.com" }
expect(response.status).to eq(200)
end
end
it "sends emails with invitations when `skip_emails` is present" do
expect_not_enqueued_with(job: :invite_email) do
put "/groups/#{group.id}/members.json?skip_email=true",
params: {
emails: "something@gmail.com",
}
expect(response.status).to eq(200)
end
end
it "displays warning when all members already exists" do
user1.update!(username: "john")
user2.update!(username: "alice")