debian-mirror-gitlab/spec/workers/project_service_worker_spec.rb
2021-09-30 23:02:18 +05:30

27 lines
730 B
Ruby

# frozen_string_literal: true
require 'spec_helper'
RSpec.describe ProjectServiceWorker, '#perform' do
let(:worker) { described_class.new }
let(:integration) { Integrations::Jira.new }
before do
allow(Integration).to receive(:find).and_return(integration)
end
it 'executes integration with given data' do
data = { test: 'test' }
expect(integration).to receive(:execute).with(data)
worker.perform(1, data)
end
it 'logs error messages' do
error = StandardError.new('invalid URL')
allow(integration).to receive(:execute).and_raise(error)
expect(Gitlab::ErrorTracking).to receive(:log_exception).with(error, integration_class: 'Integrations::Jira')
worker.perform(1, {})
end
end