summaryrefslogtreecommitdiff
path: root/spec/workers/propagate_service_template_worker_spec.rb
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2017-05-05 18:01:33 +0200
committerJames Lopez <james@jameslopez.es>2017-05-05 18:01:33 +0200
commit6ecf16b8f70335e1e6868b7c918cd031f5eb2f8d (patch)
treee57683de43fa63c278929bcba679d1077906a2fe /spec/workers/propagate_service_template_worker_spec.rb
parentce418036c763219df8239632f71ef0e9782be7ea (diff)
downloadgitlab-ce-6ecf16b8f70335e1e6868b7c918cd031f5eb2f8d.tar.gz
refactor code based on feedback
Diffstat (limited to 'spec/workers/propagate_service_template_worker_spec.rb')
-rw-r--r--spec/workers/propagate_service_template_worker_spec.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/workers/propagate_service_template_worker_spec.rb b/spec/workers/propagate_service_template_worker_spec.rb
new file mode 100644
index 00000000000..7040d5ef81c
--- /dev/null
+++ b/spec/workers/propagate_service_template_worker_spec.rb
@@ -0,0 +1,29 @@
+require 'spec_helper'
+
+describe PropagateServiceTemplateWorker do
+ let!(:service_template) do
+ PushoverService.create(
+ template: true,
+ active: true,
+ properties: {
+ device: 'MyDevice',
+ sound: 'mic',
+ priority: 4,
+ user_key: 'asdf',
+ api_key: '123456789'
+ })
+ end
+
+ before do
+ allow_any_instance_of(Gitlab::ExclusiveLease).to receive(:try_obtain).
+ and_return(true)
+ end
+
+ describe '#perform' do
+ it 'calls the propagate service with the template' do
+ expect(Projects::PropagateServiceTemplate).to receive(:propagate).with(service_template)
+
+ subject.perform(service_template.id)
+ end
+ end
+end