mirror of
https://github.com/mastodon/mastodon.git
synced 2026-03-22 10:25:13 -05:00
Some checks failed
Check i18n / check-i18n (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
CodeQL / Analyze (ruby) (push) Has been cancelled
Check formatting / 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
Ruby Testing / build (production) (push) Has been cancelled
Ruby Testing / build (test) (push) Has been cancelled
Ruby Testing / test (.ruby-version) (push) Has been cancelled
Ruby Testing / test (3.1) (push) Has been cancelled
Ruby Testing / test (3.2) (push) Has been cancelled
Ruby Testing / test (3.4) (push) Has been cancelled
Ruby Testing / Libvips tests (.ruby-version) (push) Has been cancelled
Ruby Testing / Libvips tests (3.1) (push) Has been cancelled
Ruby Testing / Libvips tests (3.2) (push) Has been cancelled
Ruby Testing / Libvips tests (3.4) (push) Has been cancelled
Ruby Testing / End to End testing (.ruby-version) (push) Has been cancelled
Ruby Testing / End to End testing (3.1) (push) Has been cancelled
Ruby Testing / End to End testing (3.2) (push) Has been cancelled
Ruby Testing / End to End testing (3.4) (push) Has been cancelled
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Has been cancelled
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:8.10.2) (push) Has been cancelled
Ruby Testing / Elastic Search integration testing (.ruby-version, opensearchproject/opensearch:2) (push) Has been cancelled
Ruby Testing / Elastic Search integration testing (3.1, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Has been cancelled
Ruby Testing / Elastic Search integration testing (3.2, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Has been cancelled
Ruby Testing / Elastic Search integration testing (3.4, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Has been cancelled
64 lines
1.7 KiB
Ruby
64 lines
1.7 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
require 'rails_helper'
|
|
|
|
RSpec.describe ActivityPub::Activity::Remove do
|
|
let(:sender) { Fabricate(:account, featured_collection_url: 'https://example.com/featured') }
|
|
|
|
describe '#perform' do
|
|
subject { described_class.new(json, sender) }
|
|
|
|
context 'when removing a pinned status' do
|
|
let(:status) { Fabricate(:status, account: sender) }
|
|
|
|
let(:json) do
|
|
{
|
|
'@context': 'https://www.w3.org/ns/activitystreams',
|
|
id: 'foo',
|
|
type: 'Remove',
|
|
actor: ActivityPub::TagManager.instance.uri_for(sender),
|
|
object: ActivityPub::TagManager.instance.uri_for(status),
|
|
target: sender.featured_collection_url,
|
|
}.deep_stringify_keys
|
|
end
|
|
|
|
before do
|
|
StatusPin.create!(account: sender, status: status)
|
|
end
|
|
|
|
it 'removes a pin' do
|
|
expect { subject.perform }
|
|
.to change { sender.pinned?(status) }.to(false)
|
|
end
|
|
end
|
|
|
|
context 'when removing a featured tag' do
|
|
let(:tag) { Fabricate(:tag) }
|
|
|
|
let(:json) do
|
|
{
|
|
'@context': 'https://www.w3.org/ns/activitystreams',
|
|
id: 'foo',
|
|
type: 'Remove',
|
|
actor: ActivityPub::TagManager.instance.uri_for(sender),
|
|
object: {
|
|
type: 'Hashtag',
|
|
name: "##{tag.display_name}",
|
|
href: "https://example.com/tags/#{tag.name}",
|
|
},
|
|
target: sender.featured_collection_url,
|
|
}.deep_stringify_keys
|
|
end
|
|
|
|
before do
|
|
sender.featured_tags.find_or_create_by!(name: tag.name)
|
|
end
|
|
|
|
it 'removes a pin' do
|
|
expect { subject.perform }
|
|
.to change { sender.featured_tags.exists?(tag: tag) }.to(false)
|
|
end
|
|
end
|
|
end
|
|
end
|