summaryrefslogtreecommitdiff
path: root/spec/support/services/issuable_update_service_shared_examples.rb
blob: 8947f20562f8bc9c0cfd61cc236e48cded082dd5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
shared_examples 'issuable update service' do
  def update_issuable(opts)
    described_class.new(project, user, opts).execute(open_issuable)
  end

  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