2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-03-13 15:44:24 +05:30
|
|
|
RSpec.shared_examples 'issuable update service' do
|
2017-08-17 22:00:37 +05:30
|
|
|
def update_issuable(opts)
|
|
|
|
described_class.new(project, user, opts).execute(open_issuable)
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'changing state' do
|
2017-09-10 17:25:29 +05:30
|
|
|
before do
|
|
|
|
expect(project).to receive(:execute_hooks).once
|
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
context 'to reopened' do
|
|
|
|
it 'executes hooks only once' do
|
2021-06-08 01:23:25 +05:30
|
|
|
described_class.new(project: project, current_user: user, params: { state_event: 'reopen' }).execute(closed_issuable)
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'to closed' do
|
|
|
|
it 'executes hooks only once' do
|
2021-06-08 01:23:25 +05:30
|
|
|
described_class.new(project: project, current_user: user, params: { state_event: 'close' }).execute(open_issuable)
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|