2019-07-07 11:18:12 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
RSpec.describe PropagateServiceTemplateWorker do
|
2018-11-08 19:23:39 +05:30
|
|
|
include ExclusiveLeaseHelpers
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
describe '#perform' do
|
|
|
|
it 'calls the propagate service with the template' do
|
2020-10-24 23:57:45 +05:30
|
|
|
template = PushoverService.create!(
|
2018-11-08 19:23:39 +05:30
|
|
|
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)
|
|
|
|
|
2020-11-24 15:15:51 +05:30
|
|
|
expect(Admin::PropagateServiceTemplate)
|
2018-11-08 19:23:39 +05:30
|
|
|
.to receive(:propagate)
|
|
|
|
.with(template)
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
subject.perform(template.id)
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|