2017-05-05 08:58:05 +00:00
|
|
|
require 'rails_helper'
|
|
|
|
require 'lib/import/import_job_backend_examples'
|
|
|
|
|
|
|
|
RSpec.describe Import::Base do
|
|
|
|
it_behaves_like 'ImportJob backend'
|
|
|
|
|
2018-02-17 11:28:38 +00:00
|
|
|
describe '#active?' do
|
|
|
|
|
|
|
|
it 'returns true by default' do
|
|
|
|
expect(described_class.active?).to be true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-05-05 08:58:05 +00:00
|
|
|
describe '#queueable?' do
|
|
|
|
|
|
|
|
it 'returns true by default' do
|
|
|
|
expect(described_class.queueable?).to be true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '.start' do
|
|
|
|
|
|
|
|
it 'raises an error if called and not overwritten' do
|
|
|
|
|
|
|
|
import_job = create(:import_job)
|
|
|
|
instance = described_class.new(import_job)
|
|
|
|
|
|
|
|
expect do
|
|
|
|
instance.start
|
|
|
|
end.to raise_error(RuntimeError)
|
|
|
|
end
|
|
|
|
end
|
2017-05-11 15:18:03 +00:00
|
|
|
|
|
|
|
describe '#reschedule?' do
|
|
|
|
|
|
|
|
it 'returns false by default' do
|
|
|
|
import_job = create(:import_job)
|
|
|
|
instance = described_class.new(import_job)
|
|
|
|
delayed_job = double()
|
|
|
|
|
|
|
|
expect(instance.reschedule?(delayed_job)).to be false
|
|
|
|
end
|
|
|
|
end
|
2017-05-05 08:58:05 +00:00
|
|
|
end
|