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:
authorMark Fletcher <mark@gitlab.com>2016-12-14 23:45:39 +0300
committerMark Fletcher <mark@gitlab.com>2016-12-16 13:52:59 +0300
commit9f97fa4d9f4e86e8f1ff1db4621bcf81390936da (patch)
tree3d5dae75cb1ce884b37d896d5d1316583d5f5c5f /spec/support/services
parent2f736c6d41acb53f70755442972f43921c2ac6f2 (diff)
Ensure issuable state changes only fire webhooks once
* Webhooks for close and reopen events now fired in respective services only * Prevents generic 'update' webhooks firing too
Diffstat (limited to 'spec/support/services')
-rw-r--r--spec/support/services/issuable_update_service_shared_examples.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/support/services/issuable_update_service_shared_examples.rb b/spec/support/services/issuable_update_service_shared_examples.rb
new file mode 100644
index 00000000000..a3336755773
--- /dev/null
+++ b/spec/support/services/issuable_update_service_shared_examples.rb
@@ -0,0 +1,17 @@
+shared_examples 'issuable update service' do
+ context 'changing state' do
+ before { expect(project).to receive(:execute_hooks).once }
+
+ context 'to reopened' do
+ it 'executes hooks only once' do
+ described_class.new(project, user, state_event: 'reopen').execute(closed_issuable)
+ end
+ end
+
+ context 'to closed' do
+ it 'executes hooks only once' do
+ described_class.new(project, user, state_event: 'close').execute(open_issuable)
+ end
+ end
+ end
+end