Commit e81ea165 authored by James Lopez's avatar James Lopez

added worker spec

parent 7ac89d05
require 'spec_helper'
describe PruneOldEventsWorker do
describe '#perform' do
let!(:service_template) do
PushoverService.create(
template: true,
properties: {
device: 'MyDevice',
sound: 'mic',
priority: 4,
api_key: '123456789'
})
end
let!(:project) { create(:empty_project) }
it 'creates services for projects' do
expect { subject.perform }.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 }
end
it 'creates the service containing the template attributes' do
subject.perform
service = Service.find_by(service_template.merge(project_id: project.id, template: false))
expect(service).not_to be_nil
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment