debian-mirror-gitlab/spec/workers/project_service_worker_spec.rb

26 lines
709 B
Ruby
Raw Normal View History

2018-12-05 23:21:45 +05:30
# frozen_string_literal: true
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe ProjectServiceWorker, '#perform' do
2018-12-05 23:21:45 +05:30
let(:worker) { described_class.new }
let(:service) { JiraService.new }
before do
2021-06-08 01:23:25 +05:30
allow(Integration).to receive(:find).and_return(service)
2018-12-05 23:21:45 +05:30
end
it 'executes service with given data' do
data = { test: 'test' }
expect(service).to receive(:execute).with(data)
worker.perform(1, data)
end
it 'logs error messages' do
allow(service).to receive(:execute).and_raise(StandardError, 'invalid URL')
expect(Sidekiq.logger).to receive(:error).with({ class: described_class.name, service_class: service.class.name, message: "invalid URL" })
worker.perform(1, {})
end
end