Merge branch 'main' into glitch-soc/merge-upstream
Conflicts: - `.prettierignore`: Upstream added a line at the end of the file, while glitch-soc had its own extra lines. Took upstream's change. - `CONTRIBUTING.md`: We have our custom CONTRIBUTING.md quoting upstream. Upstream made changes. Ported upstream changes. - `app/controllers/application_controller.rb`: Upstream made code style changes in a method that is entirely replaced in glitch-soc. Ignored the change. - `app/models/account.rb`: Code style changes textually close to glitch-soc-specific changes. Ported upstream changes. - `lib/sanitize_ext/sanitize_config.rb`: Upstream code style changes. Ignored them.
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe AccountSearchService, type: :service do
|
||||
@@ -63,7 +65,7 @@ describe AccountSearchService, type: :service do
|
||||
allow(ResolveAccountService).to receive(:new).and_return(service)
|
||||
|
||||
results = subject.call('newuser@remote.com', nil, limit: 10, resolve: false)
|
||||
expect(service).not_to have_received(:call)
|
||||
expect(service).to_not have_received(:call)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe AccountStatusesCleanupService, type: :service do
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe ActivityPub::FetchFeaturedCollectionService, type: :service do
|
||||
subject { described_class.new }
|
||||
|
||||
let(:actor) { Fabricate(:account, domain: 'example.com', uri: 'https://example.com/account', featured_collection_url: 'https://example.com/account/pinned') }
|
||||
|
||||
let!(:known_status) { Fabricate(:status, account: actor, uri: 'https://example.com/account/pinned/1') }
|
||||
@@ -56,8 +60,6 @@ RSpec.describe ActivityPub::FetchFeaturedCollectionService, type: :service do
|
||||
}.with_indifferent_access
|
||||
end
|
||||
|
||||
subject { described_class.new }
|
||||
|
||||
shared_examples 'sets pinned posts' do
|
||||
before do
|
||||
stub_request(:get, 'https://example.com/account/pinned/1').to_return(status: 200, body: Oj.dump(status_json_1))
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe ActivityPub::FetchFeaturedTagsCollectionService, type: :service do
|
||||
subject { described_class.new }
|
||||
|
||||
let(:collection_url) { 'https://example.com/account/tags' }
|
||||
let(:actor) { Fabricate(:account, domain: 'example.com', uri: 'https://example.com/account') }
|
||||
|
||||
@@ -21,15 +25,13 @@ RSpec.describe ActivityPub::FetchFeaturedTagsCollectionService, type: :service d
|
||||
}.with_indifferent_access
|
||||
end
|
||||
|
||||
subject { described_class.new }
|
||||
|
||||
shared_examples 'sets featured tags' do
|
||||
before do
|
||||
subject.call(actor, collection_url)
|
||||
end
|
||||
|
||||
it 'sets expected tags as pinned tags' do
|
||||
expect(actor.featured_tags.map(&:display_name)).to match_array ['Foo', 'bar', 'baZ']
|
||||
expect(actor.featured_tags.map(&:display_name)).to match_array %w(Foo bar baZ)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe ActivityPub::FetchRemoteAccountService, type: :service do
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe ActivityPub::FetchRemoteActorService, type: :service do
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe ActivityPub::FetchRemoteKeyService, type: :service do
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe ActivityPub::FetchRemoteStatusService, type: :service do
|
||||
include ActionView::Helpers::TextHelper
|
||||
|
||||
subject { described_class.new }
|
||||
|
||||
let!(:sender) { Fabricate(:account, domain: 'foo.bar', uri: 'https://foo.bar') }
|
||||
let!(:recipient) { Fabricate(:account) }
|
||||
|
||||
@@ -18,8 +22,6 @@ RSpec.describe ActivityPub::FetchRemoteStatusService, type: :service do
|
||||
}
|
||||
end
|
||||
|
||||
subject { described_class.new }
|
||||
|
||||
before do
|
||||
stub_request(:get, 'https://foo.bar/watch?v=12345').to_return(status: 404, body: '')
|
||||
stub_request(:get, object[:id]).to_return(body: Oj.dump(object))
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe ActivityPub::FetchRepliesService, type: :service do
|
||||
subject { described_class.new }
|
||||
|
||||
let(:actor) { Fabricate(:account, domain: 'example.com', uri: 'http://example.com/account') }
|
||||
let(:status) { Fabricate(:status, account: actor) }
|
||||
let(:collection_uri) { 'http://example.com/replies/1' }
|
||||
@@ -28,8 +32,6 @@ RSpec.describe ActivityPub::FetchRepliesService, type: :service do
|
||||
}.with_indifferent_access
|
||||
end
|
||||
|
||||
subject { described_class.new }
|
||||
|
||||
describe '#call' do
|
||||
context 'when the payload is a Collection with inlined replies' do
|
||||
context 'when passing the collection itself' do
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe ActivityPub::ProcessAccountService, type: :service do
|
||||
@@ -12,7 +14,7 @@ RSpec.describe ActivityPub::ProcessAccountService, type: :service do
|
||||
attachment: [
|
||||
{ type: 'PropertyValue', name: 'Pronouns', value: 'They/them' },
|
||||
{ type: 'PropertyValue', name: 'Occupation', value: 'Unit test' },
|
||||
{ type: 'PropertyValue', name: 'non-string', value: ['foo', 'bar'] },
|
||||
{ type: 'PropertyValue', name: 'non-string', value: %w(foo bar) },
|
||||
],
|
||||
}.with_indifferent_access
|
||||
end
|
||||
@@ -31,6 +33,8 @@ RSpec.describe ActivityPub::ProcessAccountService, type: :service do
|
||||
end
|
||||
|
||||
context 'when account is not suspended' do
|
||||
subject { described_class.new.call('alice', 'example.com', payload) }
|
||||
|
||||
let!(:account) { Fabricate(:account, username: 'alice', domain: 'example.com') }
|
||||
|
||||
let(:payload) do
|
||||
@@ -46,8 +50,6 @@ RSpec.describe ActivityPub::ProcessAccountService, type: :service do
|
||||
allow(Admin::SuspensionWorker).to receive(:perform_async)
|
||||
end
|
||||
|
||||
subject { described_class.new.call('alice', 'example.com', payload) }
|
||||
|
||||
it 'suspends account remotely' do
|
||||
expect(subject.suspended?).to be true
|
||||
expect(subject.suspension_origin_remote?).to be true
|
||||
@@ -60,6 +62,8 @@ RSpec.describe ActivityPub::ProcessAccountService, type: :service do
|
||||
end
|
||||
|
||||
context 'when account is suspended' do
|
||||
subject { described_class.new.call('alice', 'example.com', payload) }
|
||||
|
||||
let!(:account) { Fabricate(:account, username: 'alice', domain: 'example.com', display_name: '') }
|
||||
|
||||
let(:payload) do
|
||||
@@ -78,8 +82,6 @@ RSpec.describe ActivityPub::ProcessAccountService, type: :service do
|
||||
account.suspend!(origin: suspension_origin)
|
||||
end
|
||||
|
||||
subject { described_class.new.call('alice', 'example.com', payload) }
|
||||
|
||||
context 'locally' do
|
||||
let(:suspension_origin) { :local }
|
||||
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe ActivityPub::ProcessCollectionService, type: :service do
|
||||
subject { described_class.new }
|
||||
|
||||
let(:actor) { Fabricate(:account, domain: 'example.com', uri: 'http://example.com/account') }
|
||||
|
||||
let(:payload) do
|
||||
@@ -19,8 +23,6 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do
|
||||
|
||||
let(:json) { Oj.dump(payload) }
|
||||
|
||||
subject { described_class.new }
|
||||
|
||||
describe '#call' do
|
||||
context 'when actor is suspended' do
|
||||
before do
|
||||
@@ -39,7 +41,7 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do
|
||||
end
|
||||
|
||||
it 'does not process payload' do
|
||||
expect(ActivityPub::Activity).not_to receive(:factory)
|
||||
expect(ActivityPub::Activity).to_not receive(:factory)
|
||||
subject.call(json, actor)
|
||||
end
|
||||
end
|
||||
@@ -69,7 +71,7 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do
|
||||
|
||||
it 'does not process payload if no signature exists' do
|
||||
expect_any_instance_of(ActivityPub::LinkedDataSignature).to receive(:verify_actor!).and_return(nil)
|
||||
expect(ActivityPub::Activity).not_to receive(:factory)
|
||||
expect(ActivityPub::Activity).to_not receive(:factory)
|
||||
|
||||
subject.call(json, forwarder)
|
||||
end
|
||||
@@ -87,7 +89,7 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do
|
||||
payload['signature'] = { 'type' => 'RsaSignature2017' }
|
||||
|
||||
expect_any_instance_of(ActivityPub::LinkedDataSignature).to receive(:verify_actor!).and_return(nil)
|
||||
expect(ActivityPub::Activity).not_to receive(:factory)
|
||||
expect(ActivityPub::Activity).to_not receive(:factory)
|
||||
|
||||
subject.call(json, forwarder)
|
||||
end
|
||||
@@ -206,7 +208,7 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do
|
||||
end
|
||||
|
||||
it 'does not process forged payload' do
|
||||
expect(ActivityPub::Activity).not_to receive(:factory).with(
|
||||
expect(ActivityPub::Activity).to_not receive(:factory).with(
|
||||
hash_including(
|
||||
'object' => hash_including(
|
||||
'id' => 'https://example.com/users/bob/fake-status'
|
||||
@@ -216,7 +218,7 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do
|
||||
anything
|
||||
)
|
||||
|
||||
expect(ActivityPub::Activity).not_to receive(:factory).with(
|
||||
expect(ActivityPub::Activity).to_not receive(:factory).with(
|
||||
hash_including(
|
||||
'object' => hash_including(
|
||||
'content' => '<p>puck was here</p>'
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
def poll_option_json(name, votes)
|
||||
@@ -5,21 +7,9 @@ def poll_option_json(name, votes)
|
||||
end
|
||||
|
||||
RSpec.describe ActivityPub::ProcessStatusUpdateService, type: :service do
|
||||
subject { described_class.new }
|
||||
|
||||
let!(:status) { Fabricate(:status, text: 'Hello world', account: Fabricate(:account, domain: 'example.com')) }
|
||||
|
||||
let(:alice) { Fabricate(:account) }
|
||||
let(:bob) { Fabricate(:account) }
|
||||
|
||||
let(:mentions) { [] }
|
||||
let(:tags) { [] }
|
||||
let(:media_attachments) { [] }
|
||||
|
||||
before do
|
||||
mentions.each { |a| Fabricate(:mention, status: status, account: a) }
|
||||
tags.each { |t| status.tags << t }
|
||||
media_attachments.each { |m| status.media_attachments << m }
|
||||
end
|
||||
|
||||
let(:payload) do
|
||||
{
|
||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||
@@ -34,10 +24,20 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService, type: :service do
|
||||
],
|
||||
}
|
||||
end
|
||||
|
||||
let(:json) { Oj.load(Oj.dump(payload)) }
|
||||
|
||||
subject { described_class.new }
|
||||
let(:alice) { Fabricate(:account) }
|
||||
let(:bob) { Fabricate(:account) }
|
||||
|
||||
let(:mentions) { [] }
|
||||
let(:tags) { [] }
|
||||
let(:media_attachments) { [] }
|
||||
|
||||
before do
|
||||
mentions.each { |a| Fabricate(:mention, status: status, account: a) }
|
||||
tags.each { |t| status.tags << t }
|
||||
media_attachments.each { |m| status.media_attachments << m }
|
||||
end
|
||||
|
||||
describe '#call' do
|
||||
it 'updates text' do
|
||||
@@ -214,11 +214,11 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService, type: :service do
|
||||
end
|
||||
|
||||
it 'does not create any edits' do
|
||||
expect { subject.call(status, json) }.not_to change { status.reload.edits.pluck(&:id) }
|
||||
expect { subject.call(status, json) }.to_not change { status.reload.edits.pluck(&:id) }
|
||||
end
|
||||
|
||||
it 'does not update the text, spoiler_text or edited_at' do
|
||||
expect { subject.call(status, json) }.not_to change { s = status.reload; [s.text, s.spoiler_text, s.edited_at] }
|
||||
expect { subject.call(status, json) }.to_not change { s = status.reload; [s.text, s.spoiler_text, s.edited_at] }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -412,7 +412,7 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService, type: :service do
|
||||
end
|
||||
|
||||
it 'removes poll' do
|
||||
expect(status.reload.poll).to eq nil
|
||||
expect(status.reload.poll).to be_nil
|
||||
end
|
||||
|
||||
it 'records media change in edit' do
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe ActivityPub::SynchronizeFollowersService, type: :service do
|
||||
subject { described_class.new }
|
||||
|
||||
let(:actor) { Fabricate(:account, domain: 'example.com', uri: 'http://example.com/account', inbox_url: 'http://example.com/inbox') }
|
||||
let(:alice) { Fabricate(:account, username: 'alice') }
|
||||
let(:bob) { Fabricate(:account, username: 'bob') }
|
||||
@@ -25,8 +29,6 @@ RSpec.describe ActivityPub::SynchronizeFollowersService, type: :service do
|
||||
}.with_indifferent_access
|
||||
end
|
||||
|
||||
subject { described_class.new }
|
||||
|
||||
shared_examples 'synchronizes followers' do
|
||||
before do
|
||||
alice.follow!(actor)
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe AfterBlockDomainFromAccountService, type: :service do
|
||||
subject { AfterBlockDomainFromAccountService.new }
|
||||
|
||||
let!(:wolf) { Fabricate(:account, username: 'wolf', domain: 'evil.org', inbox_url: 'https://evil.org/inbox', protocol: :activitypub) }
|
||||
let!(:alice) { Fabricate(:account, username: 'alice') }
|
||||
|
||||
subject { AfterBlockDomainFromAccountService.new }
|
||||
|
||||
before do
|
||||
stub_jsonld_contexts!
|
||||
allow(ActivityPub::DeliveryWorker).to receive(:perform_async)
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe AfterBlockService, type: :service do
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe AppSignUpService, type: :service do
|
||||
subject { described_class.new }
|
||||
|
||||
let(:app) { Fabricate(:application, scopes: 'read write') }
|
||||
let(:good_params) { { username: 'alice', password: '12345678', email: 'good@email.com', agreement: true } }
|
||||
let(:remote_ip) { IPAddr.new('198.0.2.1') }
|
||||
|
||||
subject { described_class.new }
|
||||
|
||||
describe '#call' do
|
||||
it 'returns nil when registrations are closed' do
|
||||
tmp = Setting.registrations_mode
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe AuthorizeFollowService, type: :service do
|
||||
let(:sender) { Fabricate(:account, username: 'alice') }
|
||||
|
||||
subject { AuthorizeFollowService.new }
|
||||
|
||||
let(:sender) { Fabricate(:account, username: 'alice') }
|
||||
|
||||
describe 'local' do
|
||||
let(:bob) { Fabricate(:account, username: 'bob') }
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe BatchedRemoveStatusService, type: :service do
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe BlockDomainService, type: :service do
|
||||
subject { BlockDomainService.new }
|
||||
|
||||
let!(:bad_account) { Fabricate(:account, username: 'badguy666', domain: 'evil.org') }
|
||||
let!(:bad_status1) { Fabricate(:status, account: bad_account, text: 'You suck') }
|
||||
let!(:bad_status2) { Fabricate(:status, account: bad_account, text: 'Hahaha') }
|
||||
let!(:bad_attachment) { Fabricate(:media_attachment, account: bad_account, status: bad_status2, file: attachment_fixture('attachment.jpg')) }
|
||||
let!(:already_banned_account) { Fabricate(:account, username: 'badguy', domain: 'evil.org', suspended: true, silenced: true) }
|
||||
|
||||
subject { BlockDomainService.new }
|
||||
|
||||
describe 'for a suspension' do
|
||||
before do
|
||||
subject.call(DomainBlock.create!(domain: 'evil.org', severity: :suspend))
|
||||
@@ -67,9 +69,9 @@ RSpec.describe BlockDomainService, type: :service do
|
||||
end
|
||||
|
||||
it 'leaves the domains status and attachments, but clears media' do
|
||||
expect { bad_status1.reload }.not_to raise_error
|
||||
expect { bad_status2.reload }.not_to raise_error
|
||||
expect { bad_attachment.reload }.not_to raise_error
|
||||
expect { bad_status1.reload }.to_not raise_error
|
||||
expect { bad_status2.reload }.to_not raise_error
|
||||
expect { bad_attachment.reload }.to_not raise_error
|
||||
expect(bad_attachment.file.exists?).to be false
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe BlockService, type: :service do
|
||||
let(:sender) { Fabricate(:account, username: 'alice') }
|
||||
|
||||
subject { BlockService.new }
|
||||
|
||||
let(:sender) { Fabricate(:account, username: 'alice') }
|
||||
|
||||
describe 'local' do
|
||||
let(:bob) { Fabricate(:account, username: 'bob') }
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe BootstrapTimelineService, type: :service do
|
||||
|
||||
@@ -1,22 +1,24 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe ClearDomainMediaService, type: :service do
|
||||
subject { ClearDomainMediaService.new }
|
||||
|
||||
let!(:bad_account) { Fabricate(:account, username: 'badguy666', domain: 'evil.org') }
|
||||
let!(:bad_status1) { Fabricate(:status, account: bad_account, text: 'You suck') }
|
||||
let!(:bad_status2) { Fabricate(:status, account: bad_account, text: 'Hahaha') }
|
||||
let!(:bad_attachment) { Fabricate(:media_attachment, account: bad_account, status: bad_status2, file: attachment_fixture('attachment.jpg')) }
|
||||
|
||||
subject { ClearDomainMediaService.new }
|
||||
|
||||
describe 'for a silence with reject media' do
|
||||
before do
|
||||
subject.call(DomainBlock.create!(domain: 'evil.org', severity: :silence, reject_media: true))
|
||||
end
|
||||
|
||||
it 'leaves the domains status and attachments, but clears media' do
|
||||
expect { bad_status1.reload }.not_to raise_error
|
||||
expect { bad_status2.reload }.not_to raise_error
|
||||
expect { bad_attachment.reload }.not_to raise_error
|
||||
expect { bad_status1.reload }.to_not raise_error
|
||||
expect { bad_status2.reload }.to_not raise_error
|
||||
expect { bad_attachment.reload }.to_not raise_error
|
||||
expect(bad_attachment.file.exists?).to be false
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe DeleteAccountService, type: :service do
|
||||
shared_examples 'common behavior' do
|
||||
subject { described_class.new.call(account) }
|
||||
|
||||
let!(:status) { Fabricate(:status, account: account) }
|
||||
let!(:mention) { Fabricate(:mention, account: local_follower) }
|
||||
let!(:status_with_mention) { Fabricate(:status, account: account, mentions: [mention]) }
|
||||
@@ -23,8 +27,6 @@ RSpec.describe DeleteAccountService, type: :service do
|
||||
|
||||
let!(:account_note) { Fabricate(:account_note, account: account) }
|
||||
|
||||
subject { described_class.new.call(account) }
|
||||
|
||||
it 'deletes associated owned records' do
|
||||
expect { subject }.to change {
|
||||
[
|
||||
@@ -50,9 +52,9 @@ RSpec.describe DeleteAccountService, type: :service do
|
||||
|
||||
it 'deletes associated target notifications' do
|
||||
expect { subject }.to change {
|
||||
[
|
||||
'poll', 'favourite', 'status', 'mention', 'follow'
|
||||
].map { |type| Notification.where(type: type).count }
|
||||
%w(
|
||||
poll favourite status mention follow
|
||||
).map { |type| Notification.where(type: type).count }
|
||||
}.from([1, 1, 1, 1, 1]).to([0, 0, 0, 0, 0])
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe FanOutOnWriteService, type: :service do
|
||||
subject { described_class.new }
|
||||
|
||||
let(:last_active_at) { Time.now.utc }
|
||||
let(:status) { Fabricate(:status, account: alice, visibility: visibility, text: 'Hello @bob #hoge') }
|
||||
|
||||
let!(:alice) { Fabricate(:user, current_sign_in_at: last_active_at).account }
|
||||
let!(:bob) { Fabricate(:user, current_sign_in_at: last_active_at, account_attributes: { username: 'bob' }).account }
|
||||
let!(:tom) { Fabricate(:user, current_sign_in_at: last_active_at).account }
|
||||
|
||||
subject { described_class.new }
|
||||
|
||||
let(:status) { Fabricate(:status, account: alice, visibility: visibility, text: 'Hello @bob #hoge') }
|
||||
|
||||
before do
|
||||
bob.follow!(alice)
|
||||
tom.follow!(alice)
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe FavouriteService, type: :service do
|
||||
let(:sender) { Fabricate(:account, username: 'alice') }
|
||||
|
||||
subject { FavouriteService.new }
|
||||
|
||||
let(:sender) { Fabricate(:account, username: 'alice') }
|
||||
|
||||
describe 'local' do
|
||||
let(:bob) { Fabricate(:account) }
|
||||
let(:status) { Fabricate(:status, account: bob) }
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe FetchLinkCardService, type: :service do
|
||||
|
||||
@@ -62,7 +62,7 @@ describe FetchOEmbedService, type: :service do
|
||||
|
||||
it 'does not cache OEmbed endpoint' do
|
||||
subject.call('https://host.test/oembed.html', format: :xml)
|
||||
expect(Rails.cache.exist?('oembed_endpoint:host.test')).to eq false
|
||||
expect(Rails.cache.exist?('oembed_endpoint:host.test')).to be false
|
||||
end
|
||||
end
|
||||
|
||||
@@ -83,7 +83,7 @@ describe FetchOEmbedService, type: :service do
|
||||
|
||||
it 'does not cache OEmbed endpoint' do
|
||||
subject.call('https://host.test/oembed.html')
|
||||
expect(Rails.cache.exist?('oembed_endpoint:host.test')).to eq false
|
||||
expect(Rails.cache.exist?('oembed_endpoint:host.test')).to be false
|
||||
end
|
||||
end
|
||||
|
||||
@@ -104,7 +104,7 @@ describe FetchOEmbedService, type: :service do
|
||||
|
||||
it 'does not cache OEmbed endpoint' do
|
||||
subject.call('https://host.test/oembed.html')
|
||||
expect(Rails.cache.exist?('oembed_endpoint:host.test')).to eq false
|
||||
expect(Rails.cache.exist?('oembed_endpoint:host.test')).to be false
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe FetchRemoteStatusService, type: :service do
|
||||
@@ -16,6 +18,7 @@ RSpec.describe FetchRemoteStatusService, type: :service do
|
||||
|
||||
context 'protocol is :activitypub' do
|
||||
subject { described_class.new.call(note[:id], prefetched_body: prefetched_body) }
|
||||
|
||||
let(:prefetched_body) { Oj.dump(note) }
|
||||
|
||||
before do
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe FetchResourceService, type: :service do
|
||||
describe '#call' do
|
||||
let(:url) { 'http://example.com' }
|
||||
|
||||
subject { described_class.new.call(url) }
|
||||
|
||||
let(:url) { 'http://example.com' }
|
||||
|
||||
context 'with blank url' do
|
||||
let(:url) { '' }
|
||||
|
||||
@@ -74,7 +76,7 @@ RSpec.describe FetchResourceService, type: :service do
|
||||
context 'when content type is application/atom+xml' do
|
||||
let(:content_type) { 'application/atom+xml' }
|
||||
|
||||
it { is_expected.to eq nil }
|
||||
it { is_expected.to be_nil }
|
||||
end
|
||||
|
||||
context 'when content type is activity+json' do
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe FollowService, type: :service do
|
||||
let(:sender) { Fabricate(:account, username: 'alice') }
|
||||
|
||||
subject { FollowService.new }
|
||||
|
||||
let(:sender) { Fabricate(:account, username: 'alice') }
|
||||
|
||||
context 'local account' do
|
||||
describe 'locked account' do
|
||||
let(:bob) { Fabricate(:account, locked: true, username: 'bob') }
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe ImportService, type: :service do
|
||||
@@ -183,15 +185,14 @@ RSpec.describe ImportService, type: :service do
|
||||
subject { ImportService.new }
|
||||
|
||||
let!(:nare) { Fabricate(:account, username: 'nare', domain: 'թութ.հայ', locked: false, protocol: :activitypub, inbox_url: 'https://թութ.հայ/inbox') }
|
||||
let(:csv) { attachment_fixture('utf8-followers.txt') }
|
||||
let(:import) { Import.create(account: account, type: 'following', data: csv) }
|
||||
|
||||
# Make sure to not actually go to the remote server
|
||||
before do
|
||||
stub_request(:post, 'https://թութ.հայ/inbox').to_return(status: 200)
|
||||
end
|
||||
|
||||
let(:csv) { attachment_fixture('utf8-followers.txt') }
|
||||
let(:import) { Import.create(account: account, type: 'following', data: csv) }
|
||||
|
||||
it 'follows the listed account' do
|
||||
expect(account.follow_requests.count).to eq 0
|
||||
subject.call(import)
|
||||
@@ -203,6 +204,9 @@ RSpec.describe ImportService, type: :service do
|
||||
subject { ImportService.new }
|
||||
|
||||
let(:csv) { attachment_fixture('bookmark-imports.txt') }
|
||||
let(:local_account) { Fabricate(:account, username: 'foo', domain: '') }
|
||||
let!(:remote_status) { Fabricate(:status, uri: 'https://example.com/statuses/1312') }
|
||||
let!(:direct_status) { Fabricate(:status, uri: 'https://example.com/statuses/direct', visibility: :direct) }
|
||||
|
||||
around(:each) do |example|
|
||||
local_before = Rails.configuration.x.local_domain
|
||||
@@ -214,10 +218,6 @@ RSpec.describe ImportService, type: :service do
|
||||
Rails.configuration.x.local_domain = local_before
|
||||
end
|
||||
|
||||
let(:local_account) { Fabricate(:account, username: 'foo', domain: '') }
|
||||
let!(:remote_status) { Fabricate(:status, uri: 'https://example.com/statuses/1312') }
|
||||
let!(:direct_status) { Fabricate(:status, uri: 'https://example.com/statuses/direct', visibility: :direct) }
|
||||
|
||||
before do
|
||||
service = double
|
||||
allow(ActivityPub::FetchRemoteStatusService).to receive(:new).and_return(service)
|
||||
@@ -234,7 +234,7 @@ RSpec.describe ImportService, type: :service do
|
||||
subject.call(import)
|
||||
expect(account.bookmarks.map(&:status).map(&:id)).to include(local_status.id)
|
||||
expect(account.bookmarks.map(&:status).map(&:id)).to include(remote_status.id)
|
||||
expect(account.bookmarks.map(&:status).map(&:id)).not_to include(direct_status.id)
|
||||
expect(account.bookmarks.map(&:status).map(&:id)).to_not include(direct_status.id)
|
||||
expect(account.bookmarks.count).to eq 3
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe MuteService, type: :service do
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe NotifyService, type: :service do
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe PostStatusService, type: :service do
|
||||
@@ -50,7 +52,7 @@ RSpec.describe PostStatusService, type: :service do
|
||||
end
|
||||
|
||||
it 'does not change statuses count' do
|
||||
expect { subject.call(account, text: 'Hi future!', scheduled_at: future, thread: previous_status) }.not_to change { [account.statuses_count, previous_status.replies_count] }
|
||||
expect { subject.call(account, text: 'Hi future!', scheduled_at: future, thread: previous_status) }.to_not change { [account.statuses_count, previous_status.replies_count] }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -157,7 +159,7 @@ RSpec.describe PostStatusService, type: :service do
|
||||
|
||||
expect do
|
||||
subject.call(account, text: '@alice @alice @alice hey @alice')
|
||||
end.not_to raise_error
|
||||
end.to_not raise_error
|
||||
end
|
||||
|
||||
it 'processes hashtags' do
|
||||
@@ -216,7 +218,7 @@ RSpec.describe PostStatusService, type: :service do
|
||||
media_ids: [media.id]
|
||||
)
|
||||
|
||||
expect(media.reload.status).to eq nil
|
||||
expect(media.reload.status).to be_nil
|
||||
end
|
||||
|
||||
it 'does not allow attaching more than 4 files' do
|
||||
|
||||
@@ -31,7 +31,7 @@ RSpec.describe PrecomputeFeedService, type: :service do
|
||||
|
||||
subject.call(account)
|
||||
|
||||
expect(redis.zscore(FeedManager.instance.key(:home, account.id), reblog.id)).to eq nil
|
||||
expect(redis.zscore(FeedManager.instance.key(:home, account.id), reblog.id)).to be_nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe ProcessMentionsService, type: :service do
|
||||
let(:account) { Fabricate(:account, username: 'alice') }
|
||||
|
||||
subject { ProcessMentionsService.new }
|
||||
|
||||
let(:account) { Fabricate(:account, username: 'alice') }
|
||||
|
||||
context 'when mentions contain blocked accounts' do
|
||||
let(:non_blocked_account) { Fabricate(:account) }
|
||||
let(:individually_blocked_account) { Fabricate(:account) }
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe PurgeDomainService, type: :service do
|
||||
subject { PurgeDomainService.new }
|
||||
|
||||
let!(:old_account) { Fabricate(:account, domain: 'obsolete.org') }
|
||||
let!(:old_status1) { Fabricate(:status, account: old_account) }
|
||||
let!(:old_status2) { Fabricate(:status, account: old_account) }
|
||||
let!(:old_attachment) { Fabricate(:media_attachment, account: old_account, status: old_status2, file: attachment_fixture('attachment.jpg')) }
|
||||
|
||||
subject { PurgeDomainService.new }
|
||||
|
||||
describe 'for a suspension' do
|
||||
before do
|
||||
subject.call('obsolete.org')
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe ReblogService, type: :service do
|
||||
let(:alice) { Fabricate(:account, username: 'alice') }
|
||||
|
||||
context 'creates a reblog with appropriate visibility' do
|
||||
subject { ReblogService.new }
|
||||
|
||||
let(:visibility) { :public }
|
||||
let(:reblog_visibility) { :public }
|
||||
let(:status) { Fabricate(:status, account: alice, visibility: visibility) }
|
||||
|
||||
subject { ReblogService.new }
|
||||
|
||||
before do
|
||||
subject.call(alice, status, visibility: reblog_visibility)
|
||||
end
|
||||
@@ -45,11 +47,11 @@ RSpec.describe ReblogService, type: :service do
|
||||
end
|
||||
|
||||
context 'ActivityPub' do
|
||||
subject { ReblogService.new }
|
||||
|
||||
let(:bob) { Fabricate(:account, username: 'bob', protocol: :activitypub, domain: 'example.com', inbox_url: 'http://example.com/inbox') }
|
||||
let(:status) { Fabricate(:status, account: bob) }
|
||||
|
||||
subject { ReblogService.new }
|
||||
|
||||
before do
|
||||
stub_request(:post, bob.inbox_url)
|
||||
allow(ActivityPub::DistributionWorker).to receive(:perform_async)
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe RejectFollowService, type: :service do
|
||||
let(:sender) { Fabricate(:account, username: 'alice') }
|
||||
|
||||
subject { RejectFollowService.new }
|
||||
|
||||
let(:sender) { Fabricate(:account, username: 'alice') }
|
||||
|
||||
describe 'local' do
|
||||
let(:bob) { Fabricate(:account) }
|
||||
|
||||
|
||||
+4
-2
@@ -1,10 +1,12 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe RemoveFromFollowersService, type: :service do
|
||||
let(:bob) { Fabricate(:account, username: 'bob') }
|
||||
|
||||
subject { RemoveFromFollowersService.new }
|
||||
|
||||
let(:bob) { Fabricate(:account, username: 'bob') }
|
||||
|
||||
describe 'local' do
|
||||
let(:sender) { Fabricate(:account, username: 'alice') }
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe RemoveStatusService, type: :service do
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe ReportService, type: :service do
|
||||
@@ -29,13 +31,13 @@ RSpec.describe ReportService, type: :service do
|
||||
end
|
||||
|
||||
context 'when the reported status is a DM' do
|
||||
let(:target_account) { Fabricate(:account) }
|
||||
let(:status) { Fabricate(:status, account: target_account, visibility: :direct) }
|
||||
|
||||
subject do
|
||||
-> { described_class.new.call(source_account, target_account, status_ids: [status.id]) }
|
||||
end
|
||||
|
||||
let(:target_account) { Fabricate(:account) }
|
||||
let(:status) { Fabricate(:status, account: target_account, visibility: :direct) }
|
||||
|
||||
context 'when it is addressed to the reporter' do
|
||||
before do
|
||||
status.mentions.create(account: source_account)
|
||||
@@ -85,13 +87,13 @@ RSpec.describe ReportService, type: :service do
|
||||
end
|
||||
|
||||
context 'when other reports already exist for the same target' do
|
||||
let!(:target_account) { Fabricate(:account) }
|
||||
let!(:other_report) { Fabricate(:report, target_account: target_account) }
|
||||
|
||||
subject do
|
||||
-> { described_class.new.call(source_account, target_account) }
|
||||
end
|
||||
|
||||
let!(:target_account) { Fabricate(:account) }
|
||||
let!(:other_report) { Fabricate(:report, target_account: target_account) }
|
||||
|
||||
before do
|
||||
ActionMailer::Base.deliveries.clear
|
||||
source_account.user.settings.notification_emails['report'] = true
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe ResolveAccountService, type: :service do
|
||||
@@ -108,7 +110,7 @@ RSpec.describe ResolveAccountService, type: :service do
|
||||
it 'returns new remote account' do
|
||||
account = subject.call('Foo@redirected.example.com')
|
||||
|
||||
expect(account.activitypub?).to eq true
|
||||
expect(account.activitypub?).to be true
|
||||
expect(account.acct).to eq 'foo@ap.example.com'
|
||||
expect(account.inbox_url).to eq 'https://ap.example.com/users/foo/inbox'
|
||||
end
|
||||
@@ -123,7 +125,7 @@ RSpec.describe ResolveAccountService, type: :service do
|
||||
it 'returns new remote account' do
|
||||
account = subject.call('Foo@redirected.example.com')
|
||||
|
||||
expect(account.activitypub?).to eq true
|
||||
expect(account.activitypub?).to be true
|
||||
expect(account.acct).to eq 'foo@ap.example.com'
|
||||
expect(account.inbox_url).to eq 'https://ap.example.com/users/foo/inbox'
|
||||
end
|
||||
@@ -146,7 +148,7 @@ RSpec.describe ResolveAccountService, type: :service do
|
||||
it 'returns new remote account' do
|
||||
account = subject.call('foo@ap.example.com')
|
||||
|
||||
expect(account.activitypub?).to eq true
|
||||
expect(account.activitypub?).to be true
|
||||
expect(account.domain).to eq 'ap.example.com'
|
||||
expect(account.inbox_url).to eq 'https://ap.example.com/users/foo/inbox'
|
||||
end
|
||||
@@ -159,7 +161,7 @@ RSpec.describe ResolveAccountService, type: :service do
|
||||
it 'returns new remote account' do
|
||||
account = subject.call('foo@ap.example.com')
|
||||
|
||||
expect(account.activitypub?).to eq true
|
||||
expect(account.activitypub?).to be true
|
||||
expect(account.domain).to eq 'ap.example.com'
|
||||
expect(account.inbox_url).to eq 'https://ap.example.com/users/foo/inbox'
|
||||
expect(account.actor_type).to eq 'Person'
|
||||
@@ -174,7 +176,7 @@ RSpec.describe ResolveAccountService, type: :service do
|
||||
it 'returns new remote account' do
|
||||
account = subject.call('foo@ap.example.com')
|
||||
|
||||
expect(account.activitypub?).to eq true
|
||||
expect(account.activitypub?).to be true
|
||||
expect(account.domain).to eq 'ap.example.com'
|
||||
expect(account.inbox_url).to eq 'https://ap.example.com/users/foo/inbox'
|
||||
expect(account.uri).to eq 'https://ap.example.com/users/foo'
|
||||
@@ -195,7 +197,7 @@ RSpec.describe ResolveAccountService, type: :service do
|
||||
it 'returns new remote account' do
|
||||
account = subject.call('foo@ap.example.com')
|
||||
|
||||
expect(account.activitypub?).to eq true
|
||||
expect(account.activitypub?).to be true
|
||||
expect(account.domain).to eq 'ap.example.com'
|
||||
expect(account.inbox_url).to eq 'https://ap.example.com/users/foo/inbox'
|
||||
expect(account.uri).to eq 'https://ap.example.com/users/foo'
|
||||
|
||||
@@ -13,8 +13,8 @@ describe SearchService, type: :service do
|
||||
results = subject.call('', nil, 10)
|
||||
|
||||
expect(results).to eq(empty_results)
|
||||
expect(AccountSearchService).not_to have_received(:new)
|
||||
expect(Tag).not_to have_received(:search_for)
|
||||
expect(AccountSearchService).to_not have_received(:new)
|
||||
expect(Tag).to_not have_received(:search_for)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -89,7 +89,7 @@ describe SearchService, type: :service do
|
||||
allow(Tag).to receive(:search_for)
|
||||
|
||||
results = subject.call(query, nil, 10)
|
||||
expect(Tag).not_to have_received(:search_for)
|
||||
expect(Tag).to_not have_received(:search_for)
|
||||
expect(results).to eq empty_results
|
||||
end
|
||||
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe SuspendAccountService, type: :service do
|
||||
shared_examples 'common behavior' do
|
||||
subject { described_class.new.call(account) }
|
||||
|
||||
let!(:local_follower) { Fabricate(:user, current_sign_in_at: 1.hour.ago).account }
|
||||
let!(:list) { Fabricate(:list, account: local_follower) }
|
||||
|
||||
subject { described_class.new.call(account) }
|
||||
|
||||
before do
|
||||
allow(FeedManager.instance).to receive(:unmerge_from_home).and_return(nil)
|
||||
allow(FeedManager.instance).to receive(:unmerge_from_list).and_return(nil)
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe UnallowDomainService, type: :service do
|
||||
subject { UnallowDomainService.new }
|
||||
|
||||
let!(:bad_account) { Fabricate(:account, username: 'badguy666', domain: 'evil.org') }
|
||||
let!(:bad_status1) { Fabricate(:status, account: bad_account, text: 'You suck') }
|
||||
let!(:bad_status2) { Fabricate(:status, account: bad_account, text: 'Hahaha') }
|
||||
@@ -8,8 +12,6 @@ RSpec.describe UnallowDomainService, type: :service do
|
||||
let!(:already_banned_account) { Fabricate(:account, username: 'badguy', domain: 'evil.org', suspended: true, silenced: true) }
|
||||
let!(:domain_allow) { Fabricate(:domain_allow, domain: 'evil.org') }
|
||||
|
||||
subject { UnallowDomainService.new }
|
||||
|
||||
context 'in limited federation mode' do
|
||||
before do
|
||||
allow(subject).to receive(:whitelist_mode?).and_return(true)
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe UnblockService, type: :service do
|
||||
let(:sender) { Fabricate(:account, username: 'alice') }
|
||||
|
||||
subject { UnblockService.new }
|
||||
|
||||
let(:sender) { Fabricate(:account, username: 'alice') }
|
||||
|
||||
describe 'local' do
|
||||
let(:bob) { Fabricate(:account) }
|
||||
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe UnfollowService, type: :service do
|
||||
let(:sender) { Fabricate(:account, username: 'alice') }
|
||||
|
||||
subject { UnfollowService.new }
|
||||
|
||||
let(:sender) { Fabricate(:account, username: 'alice') }
|
||||
|
||||
describe 'local' do
|
||||
let(:bob) { Fabricate(:account, username: 'bob') }
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe UnmuteService, type: :service do
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe UnsuspendAccountService, type: :service do
|
||||
shared_examples 'common behavior' do
|
||||
subject { described_class.new.call(account) }
|
||||
|
||||
let!(:local_follower) { Fabricate(:user, current_sign_in_at: 1.hour.ago).account }
|
||||
let!(:list) { Fabricate(:list, account: local_follower) }
|
||||
|
||||
subject { described_class.new.call(account) }
|
||||
|
||||
before do
|
||||
allow(FeedManager.instance).to receive(:merge_into_home).and_return(nil)
|
||||
allow(FeedManager.instance).to receive(:merge_into_list).and_return(nil)
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe UpdateAccountService, type: :service do
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe UpdateStatusService, type: :service do
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe VerifyLinkService, type: :service do
|
||||
|
||||
Reference in New Issue
Block a user