diff options
author | Douwe Maan <douwe@gitlab.com> | 2018-01-18 14:37:16 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-01-18 14:37:16 +0300 |
commit | 8e9c073a146f655cea2fd13f259bd68dc2c37259 (patch) | |
tree | 01bd2ec14fd6406b1deb1947935b36463a7e4529 /spec/models/project_spec.rb | |
parent | d617c24f59f9cc1c068301ec755caa2de6cd6b73 (diff) | |
parent | 6ef1b94ccf9eb60d5cff43d7e1302129d1b43cc3 (diff) |
Merge branch 'feature/merge-request-system-hook' into 'master'
System hooks for Merge Requests
See merge request gitlab-org/gitlab-ce!14387
Diffstat (limited to 'spec/models/project_spec.rb')
-rw-r--r-- | spec/models/project_spec.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 78223c44999..987be8e8b46 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -3206,4 +3206,23 @@ describe Project do expect { project.write_repository_config }.not_to raise_error end end + + describe '#execute_hooks' do + it 'executes the projects hooks with the specified scope' do + hook1 = create(:project_hook, merge_requests_events: true, tag_push_events: false) + hook2 = create(:project_hook, merge_requests_events: false, tag_push_events: true) + project = create(:project, hooks: [hook1, hook2]) + + expect_any_instance_of(ProjectHook).to receive(:async_execute).once + + project.execute_hooks({}, :tag_push_hooks) + end + + it 'executes the system hooks with the specified scope' do + expect_any_instance_of(SystemHooksService).to receive(:execute_hooks).with({ data: 'data' }, :merge_request_hooks) + + project = build(:project) + project.execute_hooks({ data: 'data' }, :merge_request_hooks) + end + end end |