2017-05-03 13:43:26 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-05-03 15:20:12 +00:00
|
|
|
describe PropagateProjectServiceWorker 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
|
|
|
|
allow_any_instance_of(Gitlab::ExclusiveLease).to receive(:try_obtain).
|
|
|
|
and_return(true)
|
|
|
|
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-04 16:11:28 +00:00
|
|
|
expect(Projects::PropagateService).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
|