2017-05-03 13:43:26 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-05-05 16:01:33 +00:00
|
|
|
describe PropagateServiceTemplateWorker do
|
2017-05-04 10:13:33 +00:00
|
|
|
let!(:service_template) do
|
|
|
|
PushoverService.create(
|
|
|
|
template: true,
|
|
|
|
active: true,
|
|
|
|
properties: {
|
|
|
|
device: 'MyDevice',
|
|
|
|
sound: 'mic',
|
|
|
|
priority: 4,
|
|
|
|
user_key: 'asdf',
|
|
|
|
api_key: '123456789'
|
|
|
|
})
|
|
|
|
end
|
2017-05-03 13:43:26 +00:00
|
|
|
|
2017-05-04 10:13:33 +00:00
|
|
|
before do
|
2017-06-21 13:48:12 +00:00
|
|
|
allow_any_instance_of(Gitlab::ExclusiveLease).to receive(:try_obtain)
|
|
|
|
.and_return(true)
|
2017-05-04 10:13:33 +00:00
|
|
|
end
|
2017-05-03 13:43:26 +00:00
|
|
|
|
2017-05-04 10:13:33 +00:00
|
|
|
describe '#perform' do
|
|
|
|
it 'calls the propagate service with the template' do
|
2017-05-05 16:01:33 +00:00
|
|
|
expect(Projects::PropagateServiceTemplate).to receive(:propagate).with(service_template)
|
2017-05-03 13:43:26 +00:00
|
|
|
|
2017-05-03 15:20:12 +00:00
|
|
|
subject.perform(service_template.id)
|
2017-05-03 13:43:26 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|