summaryrefslogtreecommitdiff
path: root/spec/workers/propagate_service_template_worker_spec.rb
blob: af1fb80a51d1b3047e0cab68a7d511119aada738 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
require 'spec_helper'

describe PropagateServiceTemplateWorker do
  include ExclusiveLeaseHelpers

  describe '#perform' do
    it 'calls the propagate service with the template' do
      template = PushoverService.create(
        template: true,
        active: true,
        properties: {
          device: 'MyDevice',
          sound: 'mic',
          priority: 4,
          user_key: 'asdf',
          api_key: '123456789'
        })

      stub_exclusive_lease("propagate_service_template_worker:#{template.id}",
        timeout: PropagateServiceTemplateWorker::LEASE_TIMEOUT)

      expect(Projects::PropagateServiceTemplate)
        .to receive(:propagate)
        .with(template)

      subject.perform(template.id)
    end
  end
end