base_spec.rb 1010 B

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