mirror of
https://framagit.org/tykayn/mastodon.git
synced 2023-08-25 08:33:12 +02:00
1060666c58
* Add support for editing for published statuses * Fix references to stripped-out code * Various fixes and improvements * Further fixes and improvements * Fix updates being potentially sent to unauthorized recipients * Various fixes and improvements * Fix wrong words in test * Fix notifying accounts that were tagged but were not in the audience * Fix mistake
53 lines
1.7 KiB
Ruby
53 lines
1.7 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
require 'rails_helper'
|
|
|
|
describe FeedInsertWorker do
|
|
subject { described_class.new }
|
|
|
|
describe 'perform' do
|
|
let(:follower) { Fabricate(:account) }
|
|
let(:status) { Fabricate(:status) }
|
|
|
|
context 'when there are no records' do
|
|
it 'skips push with missing status' do
|
|
instance = double(push_to_home: nil)
|
|
allow(FeedManager).to receive(:instance).and_return(instance)
|
|
result = subject.perform(nil, follower.id)
|
|
|
|
expect(result).to eq true
|
|
expect(instance).not_to have_received(:push_to_home)
|
|
end
|
|
|
|
it 'skips push with missing account' do
|
|
instance = double(push_to_home: nil)
|
|
allow(FeedManager).to receive(:instance).and_return(instance)
|
|
result = subject.perform(status.id, nil)
|
|
|
|
expect(result).to eq true
|
|
expect(instance).not_to have_received(:push_to_home)
|
|
end
|
|
end
|
|
|
|
context 'when there are real records' do
|
|
it 'skips the push when there is a filter' do
|
|
instance = double(push_to_home: nil, filter?: true)
|
|
allow(FeedManager).to receive(:instance).and_return(instance)
|
|
result = subject.perform(status.id, follower.id)
|
|
|
|
expect(result).to be_nil
|
|
expect(instance).not_to have_received(:push_to_home)
|
|
end
|
|
|
|
it 'pushes the status onto the home timeline without filter' do
|
|
instance = double(push_to_home: nil, filter?: false)
|
|
allow(FeedManager).to receive(:instance).and_return(instance)
|
|
result = subject.perform(status.id, follower.id)
|
|
|
|
expect(result).to be_nil
|
|
expect(instance).to have_received(:push_to_home).with(follower, status, update: nil)
|
|
end
|
|
end
|
|
end
|
|
end
|