summaryrefslogtreecommitdiff
path: root/spec/workers
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2017-05-03 17:20:12 +0200
committerJames Lopez <james@jameslopez.es>2017-05-03 17:20:12 +0200
commit264bf229277caf1c1eaca4e83921ca1b305d5401 (patch)
tree610c4b0427f8303a5484c06e6f4779b7c9e1669d /spec/workers
parente81ea165ba738fedab07d5e20423856e004e2594 (diff)
downloadgitlab-ce-264bf229277caf1c1eaca4e83921ca1b305d5401.tar.gz
add propagate service worker and updated spec and controller
Diffstat (limited to 'spec/workers')
-rw-r--r--spec/workers/propagate_project_service_worker_spec.rb19
1 files changed, 13 insertions, 6 deletions
diff --git a/spec/workers/propagate_project_service_worker_spec.rb b/spec/workers/propagate_project_service_worker_spec.rb
index ce01a663a8f..d525a8b4a23 100644
--- a/spec/workers/propagate_project_service_worker_spec.rb
+++ b/spec/workers/propagate_project_service_worker_spec.rb
@@ -1,36 +1,43 @@
require 'spec_helper'
-describe PruneOldEventsWorker do
+describe PropagateProjectServiceWorker do
describe '#perform' 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
let!(:project) { create(:empty_project) }
+ before do
+ allow_any_instance_of(Gitlab::ExclusiveLease).to receive(:try_obtain).
+ and_return(true)
+ end
+
it 'creates services for projects' do
- expect { subject.perform }.to change { Service.count }.by(1)
+ expect { subject.perform(service_template.id) }.to change { Service.count }.by(1)
end
it 'does not create the service if it exists already' do
Service.build_from_template(project.id, service_template).save!
- expect { subject.perform }.not_to change { Service.count }
+ expect { subject.perform(service_template.id) }.not_to change { Service.count }
end
it 'creates the service containing the template attributes' do
- subject.perform
+ subject.perform(service_template.id)
- service = Service.find_by(service_template.merge(project_id: project.id, template: false))
+ service = Service.find_by(type: service_template.type, template: false)
- expect(service).not_to be_nil
+ expect(service.properties).to eq(service_template.properties)
end
end
end