Refactoring - DRYing up code. Use existing .backends
method.
This commit is contained in:
parent
3034ff7e97
commit
163a5f2f26
2 changed files with 2 additions and 10 deletions
|
@ -109,15 +109,7 @@ class ImportJob < ApplicationModel
|
|||
#
|
||||
# return [nil]
|
||||
def self.queue_registered
|
||||
import_backends = Setting.get('import_backends')
|
||||
return if import_backends.blank?
|
||||
|
||||
import_backends.each do |backend|
|
||||
|
||||
if !backend_valid?(backend)
|
||||
Rails.logger.error "Invalid import backend '#{backend}'"
|
||||
next
|
||||
end
|
||||
backends.each do |backend|
|
||||
|
||||
# skip backends that are not "ready" yet
|
||||
next if !backend.constantize.queueable?
|
||||
|
|
|
@ -120,7 +120,7 @@ RSpec.describe ImportJob do
|
|||
it 'logs errors for invalid registered backends' do
|
||||
allow(Setting).to receive(:get)
|
||||
expect(Setting).to receive(:get).with('import_backends').and_return(['InvalidBackend'])
|
||||
expect(Rails.logger).to receive(:error)
|
||||
expect(described_class.logger).to receive(:error)
|
||||
described_class.queue_registered
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue