dawarich/spec/jobs/import/watcher_job_spec.rb

32 lines
771 B
Ruby
Raw Normal View History

2024-10-03 09:27:30 -04:00
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe Import::WatcherJob, type: :job do
2024-10-03 09:27:30 -04:00
describe '#perform' do
context 'when Dawarich is not self-hosted' do
before do
allow(DawarichSettings).to receive(:self_hosted?).and_return(false)
end
2024-10-03 09:27:30 -04:00
it 'does not call Imports::Watcher' do
expect_any_instance_of(Imports::Watcher).not_to receive(:call)
described_class.perform_now
end
end
context 'when Dawarich is self-hosted' do
before do
allow(DawarichSettings).to receive(:self_hosted?).and_return(true)
end
it 'calls Imports::Watcher' do
expect_any_instance_of(Imports::Watcher).to receive(:call)
described_class.perform_now
end
2024-10-03 09:27:30 -04:00
end
end
end