mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-19 07:57:00 +00:00
Add basic coverage for some worker jobs (#23943)
This commit is contained in:
parent
f9c2213ae5
commit
39e7525c96
19
spec/workers/admin/account_deletion_worker_spec.rb
Normal file
19
spec/workers/admin/account_deletion_worker_spec.rb
Normal file
|
@ -0,0 +1,19 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe Admin::AccountDeletionWorker do
|
||||
let(:worker) { described_class.new }
|
||||
|
||||
describe 'perform' do
|
||||
let(:account) { Fabricate(:account) }
|
||||
let(:service) { instance_double(DeleteAccountService, call: true) }
|
||||
|
||||
it 'calls delete account service' do
|
||||
allow(DeleteAccountService).to receive(:new).and_return(service)
|
||||
worker.perform(account.id)
|
||||
|
||||
expect(service).to have_received(:call).with(account, { reserve_email: true, reserve_username: true })
|
||||
end
|
||||
end
|
||||
end
|
19
spec/workers/cache_buster_worker_spec.rb
Normal file
19
spec/workers/cache_buster_worker_spec.rb
Normal file
|
@ -0,0 +1,19 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe CacheBusterWorker do
|
||||
let(:worker) { described_class.new }
|
||||
|
||||
describe 'perform' do
|
||||
let(:path) { 'https://example.com' }
|
||||
let(:service) { instance_double(CacheBuster, bust: true) }
|
||||
|
||||
it 'calls the cache buster' do
|
||||
allow(CacheBuster).to receive(:new).and_return(service)
|
||||
worker.perform(path)
|
||||
|
||||
expect(service).to have_received(:bust).with(path)
|
||||
end
|
||||
end
|
||||
end
|
13
spec/workers/poll_expiration_notify_worker_spec.rb
Normal file
13
spec/workers/poll_expiration_notify_worker_spec.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe PollExpirationNotifyWorker do
|
||||
let(:worker) { described_class.new }
|
||||
|
||||
describe 'perform' do
|
||||
it 'runs without error for missing record' do
|
||||
expect { worker.perform(nil) }.to_not raise_error
|
||||
end
|
||||
end
|
||||
end
|
13
spec/workers/post_process_media_worker_spec.rb
Normal file
13
spec/workers/post_process_media_worker_spec.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe PostProcessMediaWorker do
|
||||
let(:worker) { described_class.new }
|
||||
|
||||
describe 'perform' do
|
||||
it 'runs without error for missing record' do
|
||||
expect { worker.perform(nil) }.to_not raise_error
|
||||
end
|
||||
end
|
||||
end
|
13
spec/workers/push_conversation_worker_spec.rb
Normal file
13
spec/workers/push_conversation_worker_spec.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe PushConversationWorker do
|
||||
let(:worker) { described_class.new }
|
||||
|
||||
describe 'perform' do
|
||||
it 'runs without error for missing record' do
|
||||
expect { worker.perform(nil) }.to_not raise_error
|
||||
end
|
||||
end
|
||||
end
|
13
spec/workers/push_encrypted_message_worker_spec.rb
Normal file
13
spec/workers/push_encrypted_message_worker_spec.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe PushEncryptedMessageWorker do
|
||||
let(:worker) { described_class.new }
|
||||
|
||||
describe 'perform' do
|
||||
it 'runs without error for missing record' do
|
||||
expect { worker.perform(nil) }.to_not raise_error
|
||||
end
|
||||
end
|
||||
end
|
16
spec/workers/push_update_worker_spec.rb
Normal file
16
spec/workers/push_update_worker_spec.rb
Normal file
|
@ -0,0 +1,16 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe PushUpdateWorker do
|
||||
let(:worker) { described_class.new }
|
||||
|
||||
describe 'perform' do
|
||||
it 'runs without error for missing record' do
|
||||
account_id = nil
|
||||
status_id = nil
|
||||
|
||||
expect { worker.perform(account_id, status_id) }.to_not raise_error
|
||||
end
|
||||
end
|
||||
end
|
13
spec/workers/redownload_avatar_worker_spec.rb
Normal file
13
spec/workers/redownload_avatar_worker_spec.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe RedownloadAvatarWorker do
|
||||
let(:worker) { described_class.new }
|
||||
|
||||
describe 'perform' do
|
||||
it 'runs without error for missing record' do
|
||||
expect { worker.perform(nil) }.to_not raise_error
|
||||
end
|
||||
end
|
||||
end
|
13
spec/workers/redownload_header_worker_spec.rb
Normal file
13
spec/workers/redownload_header_worker_spec.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe RedownloadHeaderWorker do
|
||||
let(:worker) { described_class.new }
|
||||
|
||||
describe 'perform' do
|
||||
it 'runs without error for missing record' do
|
||||
expect { worker.perform(nil) }.to_not raise_error
|
||||
end
|
||||
end
|
||||
end
|
15
spec/workers/remove_featured_tag_worker_spec.rb
Normal file
15
spec/workers/remove_featured_tag_worker_spec.rb
Normal file
|
@ -0,0 +1,15 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe RemoveFeaturedTagWorker do
|
||||
let(:worker) { described_class.new }
|
||||
|
||||
describe 'perform' do
|
||||
it 'runs without error for missing record' do
|
||||
account_id = nil
|
||||
featured_tag_id = nil
|
||||
expect { worker.perform(account_id, featured_tag_id) }.to_not raise_error
|
||||
end
|
||||
end
|
||||
end
|
13
spec/workers/resolve_account_worker_spec.rb
Normal file
13
spec/workers/resolve_account_worker_spec.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe ResolveAccountWorker do
|
||||
let(:worker) { described_class.new }
|
||||
|
||||
describe 'perform' do
|
||||
it 'runs without error for missing record' do
|
||||
expect { worker.perform(nil) }.to_not raise_error
|
||||
end
|
||||
end
|
||||
end
|
13
spec/workers/scheduler/indexing_scheduler_spec.rb
Normal file
13
spec/workers/scheduler/indexing_scheduler_spec.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe Scheduler::IndexingScheduler do
|
||||
let(:worker) { described_class.new }
|
||||
|
||||
describe 'perform' do
|
||||
it 'runs without error' do
|
||||
expect { worker.perform }.to_not raise_error
|
||||
end
|
||||
end
|
||||
end
|
13
spec/workers/scheduler/instance_refresh_scheduler_spec.rb
Normal file
13
spec/workers/scheduler/instance_refresh_scheduler_spec.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe Scheduler::InstanceRefreshScheduler do
|
||||
let(:worker) { described_class.new }
|
||||
|
||||
describe 'perform' do
|
||||
it 'runs without error' do
|
||||
expect { worker.perform }.to_not raise_error
|
||||
end
|
||||
end
|
||||
end
|
13
spec/workers/scheduler/ip_cleanup_scheduler_spec.rb
Normal file
13
spec/workers/scheduler/ip_cleanup_scheduler_spec.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe Scheduler::IpCleanupScheduler do
|
||||
let(:worker) { described_class.new }
|
||||
|
||||
describe 'perform' do
|
||||
it 'runs without error' do
|
||||
expect { worker.perform }.to_not raise_error
|
||||
end
|
||||
end
|
||||
end
|
13
spec/workers/scheduler/pghero_scheduler_spec.rb
Normal file
13
spec/workers/scheduler/pghero_scheduler_spec.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe Scheduler::PgheroScheduler do
|
||||
let(:worker) { described_class.new }
|
||||
|
||||
describe 'perform' do
|
||||
it 'runs without error' do
|
||||
expect { worker.perform }.to_not raise_error
|
||||
end
|
||||
end
|
||||
end
|
13
spec/workers/scheduler/scheduled_statuses_scheduler_spec.rb
Normal file
13
spec/workers/scheduler/scheduled_statuses_scheduler_spec.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe Scheduler::ScheduledStatusesScheduler do
|
||||
let(:worker) { described_class.new }
|
||||
|
||||
describe 'perform' do
|
||||
it 'runs without error' do
|
||||
expect { worker.perform }.to_not raise_error
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,13 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe Scheduler::SuspendedUserCleanupScheduler do
|
||||
let(:worker) { described_class.new }
|
||||
|
||||
describe 'perform' do
|
||||
it 'runs without error' do
|
||||
expect { worker.perform }.to_not raise_error
|
||||
end
|
||||
end
|
||||
end
|
13
spec/workers/scheduler/trends/refresh_scheduler_spec.rb
Normal file
13
spec/workers/scheduler/trends/refresh_scheduler_spec.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe Scheduler::Trends::RefreshScheduler do
|
||||
let(:worker) { described_class.new }
|
||||
|
||||
describe 'perform' do
|
||||
it 'runs without error' do
|
||||
expect { worker.perform }.to_not raise_error
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,13 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe Scheduler::Trends::ReviewNotificationsScheduler do
|
||||
let(:worker) { described_class.new }
|
||||
|
||||
describe 'perform' do
|
||||
it 'runs without error' do
|
||||
expect { worker.perform }.to_not raise_error
|
||||
end
|
||||
end
|
||||
end
|
13
spec/workers/scheduler/vacuum_scheduler_spec.rb
Normal file
13
spec/workers/scheduler/vacuum_scheduler_spec.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe Scheduler::VacuumScheduler do
|
||||
let(:worker) { described_class.new }
|
||||
|
||||
describe 'perform' do
|
||||
it 'runs without error' do
|
||||
expect { worker.perform }.to_not raise_error
|
||||
end
|
||||
end
|
||||
end
|
13
spec/workers/unpublish_announcement_worker_spec.rb
Normal file
13
spec/workers/unpublish_announcement_worker_spec.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe UnpublishAnnouncementWorker do
|
||||
let(:worker) { described_class.new }
|
||||
|
||||
describe 'perform' do
|
||||
it 'runs without error for missing record' do
|
||||
expect { worker.perform(nil) }.to_not raise_error
|
||||
end
|
||||
end
|
||||
end
|
13
spec/workers/webhooks/delivery_worker_spec.rb
Normal file
13
spec/workers/webhooks/delivery_worker_spec.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe Webhooks::DeliveryWorker do
|
||||
let(:worker) { described_class.new }
|
||||
|
||||
describe 'perform' do
|
||||
it 'runs without error' do
|
||||
expect { worker.perform(nil, nil) }.to_not raise_error
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue