summaryrefslogtreecommitdiff
path: root/spec/support/services/issuable_update_service_shared_examples.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/support/services/issuable_update_service_shared_examples.rb')
-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