Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrandon Williams <brandon@amazee.io>2019-08-29 02:27:18 +0300
committerBrandon Williams <brandon@amazee.io>2019-09-03 02:35:36 +0300
commit2bd4d580d17e91605b4f350eafb2e9a50d6181c7 (patch)
tree65b26cd311a61fd7c2854717cd916e0787c1fd59 /spec/models/hooks
parent5c8545edf1b78ef4e93e7fd4207102aca02a85c0 (diff)
Add system hooks for project/group membership updates
When updating group and project members, new system hooks `user_update_for_group` and `user_update_for_team` will be executed. Fixes https://gitlab.com/gitlab-org/gitlab-ee/issues/12252
Diffstat (limited to 'spec/models/hooks')
-rw-r--r--spec/models/hooks/system_hook_spec.rb23
1 files changed, 21 insertions, 2 deletions
diff --git a/spec/models/hooks/system_hook_spec.rb b/spec/models/hooks/system_hook_spec.rb
index e0d4d2e4858..a4d202dc4f8 100644
--- a/spec/models/hooks/system_hook_spec.rb
+++ b/spec/models/hooks/system_hook_spec.rb
@@ -64,7 +64,7 @@ describe SystemHook do
).once
end
- it "project_create hook" do
+ it "project member create hook" do
project.add_maintainer(user)
expect(WebMock).to have_requested(:post, system_hook.url).with(
@@ -73,7 +73,7 @@ describe SystemHook do
).once
end
- it "project_destroy hook" do
+ it "project member destroy hook" do
project.add_maintainer(user)
project.project_members.destroy_all # rubocop: disable DestroyAll
@@ -83,6 +83,15 @@ describe SystemHook do
).once
end
+ it "project member update hook" do
+ project.add_guest(user)
+
+ expect(WebMock).to have_requested(:post, system_hook.url).with(
+ body: /user_update_for_team/,
+ headers: { 'Content-Type' => 'application/json', 'X-Gitlab-Event' => 'System Hook' }
+ ).once
+ end
+
it 'group create hook' do
create(:group)
@@ -119,6 +128,16 @@ describe SystemHook do
headers: { 'Content-Type' => 'application/json', 'X-Gitlab-Event' => 'System Hook' }
).once
end
+
+ it 'group member update hook' do
+ group.add_guest(user)
+ group.add_maintainer(user)
+
+ expect(WebMock).to have_requested(:post, system_hook.url).with(
+ body: /user_update_for_group/,
+ headers: { 'Content-Type' => 'application/json', 'X-Gitlab-Event' => 'System Hook' }
+ ).once
+ end
end
describe '.repository_update_hooks' do