mastodon/spec/serializers/activitypub/actor_serializer_spec.rb
David Roetzel 572612fde9
Some checks failed
Check i18n / check-i18n (push) Waiting to run
Chromatic / Check for relevant changes (push) Waiting to run
Chromatic / Run Chromatic (push) Blocked by required conditions
CodeQL / Analyze (actions) (push) Waiting to run
CodeQL / Analyze (javascript) (push) Waiting to run
CodeQL / Analyze (ruby) (push) Waiting to run
Check formatting / lint (push) Waiting to run
Ruby Testing / build (production) (push) Waiting to run
Ruby Testing / build (test) (push) Waiting to run
Ruby Testing / test (.ruby-version) (push) Blocked by required conditions
Ruby Testing / test (3.3) (push) Blocked by required conditions
Ruby Testing / test (3.4) (push) Blocked by required conditions
Ruby Testing / End to End testing (.ruby-version) (push) Blocked by required conditions
Ruby Testing / End to End testing (3.3) (push) Blocked by required conditions
Ruby Testing / End to End testing (3.4) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:7.17.29) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:8.19.2) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, opensearchproject/opensearch:2) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (3.3, docker.elastic.co/elasticsearch/elasticsearch:7.17.29) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (3.4, docker.elastic.co/elasticsearch/elasticsearch:7.17.29) (push) Blocked by required conditions
Bundler Audit / security (push) Has been cancelled
Haml Linting / lint (push) Has been cancelled
Ruby Linting / lint (push) Has been cancelled
Historical data migration test / test (14-alpine) (push) Has been cancelled
Historical data migration test / test (15-alpine) (push) Has been cancelled
Historical data migration test / test (16-alpine) (push) Has been cancelled
Historical data migration test / test (17-alpine) (push) Has been cancelled
Remove collections feature flag (#39211)
2026-05-29 09:37:42 +00:00

78 lines
2.2 KiB
Ruby

# frozen_string_literal: true
require 'rails_helper'
RSpec.describe ActivityPub::ActorSerializer do
subject { serialized_record_json(record, described_class, adapter: ActivityPub::Adapter) }
describe '#type' do
context 'with the instance actor' do
let(:record) { Account.find(Account::INSTANCE_ACTOR_ID) }
it { is_expected.to include('type' => 'Application') }
end
context 'with an application actor' do
let(:record) { Fabricate :account, actor_type: 'Application' }
it { is_expected.to include('type' => 'Service') }
end
context 'with a service actor' do
let(:record) { Fabricate :account, actor_type: 'Service' }
it { is_expected.to include('type' => 'Service') }
end
context 'with a Group actor' do
let(:record) { Fabricate :account, actor_type: 'Group' }
it { is_expected.to include('type' => 'Group') }
end
context 'with a Person actor' do
let(:record) { Fabricate :account, actor_type: 'Person' }
it { is_expected.to include('type' => 'Person') }
end
end
describe '#interactionPolicy' do
let(:record) { Fabricate(:account) }
context 'when actor is discoverable' do
it 'includes an automatic policy allowing everyone' do
expect(subject).to include('interactionPolicy' => {
'canFeature' => {
'automaticApproval' => ['https://www.w3.org/ns/activitystreams#Public'],
},
})
end
context 'when actor is locked' do
let(:record) { Fabricate(:account, locked: true) }
it 'includes an automatic policy allowing followers' do
expect(subject).to include('interactionPolicy' => {
'canFeature' => {
'automaticApproval' => [ActivityPub::TagManager.instance.followers_uri_for(record)],
},
})
end
end
end
context 'when actor is not discoverable' do
let(:record) { Fabricate(:account, discoverable: false) }
it 'includes an automatic policy limited to the actor itself' do
expect(subject).to include('interactionPolicy' => {
'canFeature' => {
'automaticApproval' => [ActivityPub::TagManager.instance.uri_for(record)],
},
})
end
end
end
end