2016-12-14 20:45:39 +00:00
|
|
|
shared_examples 'issuable update service' do
|
2016-12-14 21:39:53 +00:00
|
|
|
def update_issuable(opts)
|
|
|
|
described_class.new(project, user, opts).execute(open_issuable)
|
|
|
|
end
|
|
|
|
|
2016-12-14 20:45:39 +00:00
|
|
|
context 'changing state' do
|
2017-06-14 18:18:56 +00:00
|
|
|
before do
|
|
|
|
expect(project).to receive(:execute_hooks).once
|
|
|
|
end
|
2016-12-14 20:45:39 +00:00
|
|
|
|
|
|
|
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
|