base_spec.rb 935 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. require 'rails_helper'
  2. require 'lib/import/import_job_backend_examples'
  3. RSpec.describe Import::Base do
  4. it_behaves_like 'ImportJob backend'
  5. describe '#active?' do
  6. it 'returns true by default' do
  7. expect(described_class.active?).to be true
  8. end
  9. end
  10. describe '#queueable?' do
  11. it 'returns true by default' do
  12. expect(described_class.queueable?).to be true
  13. end
  14. end
  15. describe '.start' do
  16. it 'raises an error if called and not overwritten' do
  17. import_job = create(:import_job)
  18. instance = described_class.new(import_job)
  19. expect do
  20. instance.start
  21. end.to raise_error(RuntimeError)
  22. end
  23. end
  24. describe '#reschedule?' do
  25. it 'returns false by default' do
  26. import_job = create(:import_job)
  27. instance = described_class.new(import_job)
  28. delayed_job = double()
  29. expect(instance.reschedule?(delayed_job)).to be false
  30. end
  31. end
  32. end