mirror of
https://github.com/mastodon/mastodon.git
synced 2026-06-11 02:00:48 -05:00
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
56 lines
1.7 KiB
Ruby
56 lines
1.7 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
require 'rails_helper'
|
|
|
|
RSpec.describe ActivityPub::FlagSerializer do
|
|
subject { serialized_record_json(report, described_class, adapter: ActivityPub::Adapter) }
|
|
|
|
let(:tag_manager) { ActivityPub::TagManager.instance }
|
|
let(:report) { Fabricate(:report, comment: 'good reason') }
|
|
|
|
it 'serializes to the expected json' do
|
|
expect(subject).to include({
|
|
'id' => tag_manager.uri_for(report),
|
|
'type' => 'Flag',
|
|
'actor' => tag_manager.uri_for(report.account),
|
|
'content' => 'good reason',
|
|
'object' => [tag_manager.uri_for(report.target_account)],
|
|
})
|
|
|
|
expect(subject).to_not have_key('published')
|
|
expect(subject).to_not have_key('to')
|
|
expect(subject).to_not have_key('cc')
|
|
expect(subject).to_not have_key('target')
|
|
end
|
|
|
|
context 'with status' do
|
|
let(:target_account) { Fabricate(:account) }
|
|
let(:status) { Fabricate(:status, account: target_account) }
|
|
let(:report) { Fabricate(:report, target_account:, status_ids: [status.id]) }
|
|
|
|
it 'includes the status URI in `object`' do
|
|
expect(subject).to include({
|
|
'object' => [
|
|
tag_manager.uri_for(target_account),
|
|
tag_manager.uri_for(status),
|
|
],
|
|
})
|
|
end
|
|
end
|
|
|
|
context 'with collection' do
|
|
let(:target_account) { Fabricate(:account) }
|
|
let(:collection) { Fabricate(:collection, account: target_account) }
|
|
let(:report) { Fabricate(:report, target_account:, collections: [collection]) }
|
|
|
|
it 'includes the collection URI in `object`' do
|
|
expect(subject).to include({
|
|
'object' => [
|
|
tag_manager.uri_for(target_account),
|
|
tag_manager.uri_for(collection),
|
|
],
|
|
})
|
|
end
|
|
end
|
|
end
|