2017-08-08 12:52:15 -07:00
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
RSpec.describe ActivityPub::Activity::Update do
|
|
|
|
let!(:sender) { Fabricate(:account) }
|
2017-09-08 03:00:17 -07:00
|
|
|
|
2017-08-08 12:52:15 -07:00
|
|
|
before do
|
2017-09-08 03:00:17 -07:00
|
|
|
stub_request(:get, actor_json[:outbox]).to_return(status: 404)
|
|
|
|
stub_request(:get, actor_json[:followers]).to_return(status: 404)
|
|
|
|
stub_request(:get, actor_json[:following]).to_return(status: 404)
|
2018-03-04 00:19:11 -08:00
|
|
|
stub_request(:get, actor_json[:featured]).to_return(status: 404)
|
2017-09-08 03:00:17 -07:00
|
|
|
|
2017-08-08 12:52:15 -07:00
|
|
|
sender.update!(uri: ActivityPub::TagManager.instance.uri_for(sender))
|
|
|
|
end
|
|
|
|
|
2017-09-08 03:00:17 -07:00
|
|
|
let(:modified_sender) do
|
2021-05-07 05:33:19 -07:00
|
|
|
sender.tap do |modified_sender|
|
2017-08-08 12:52:15 -07:00
|
|
|
modified_sender.display_name = 'Totally modified now'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
let(:actor_json) do
|
2019-09-03 13:52:32 -07:00
|
|
|
ActiveModelSerializers::SerializableResource.new(modified_sender, serializer: ActivityPub::ActorSerializer, adapter: ActivityPub::Adapter).as_json
|
2017-08-08 12:52:15 -07:00
|
|
|
end
|
|
|
|
|
|
|
|
let(:json) do
|
|
|
|
{
|
|
|
|
'@context': 'https://www.w3.org/ns/activitystreams',
|
|
|
|
id: 'foo',
|
|
|
|
type: 'Update',
|
|
|
|
actor: ActivityPub::TagManager.instance.uri_for(sender),
|
|
|
|
object: actor_json,
|
|
|
|
}.with_indifferent_access
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#perform' do
|
|
|
|
subject { described_class.new(json, sender) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
subject.perform
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'updates profile' do
|
|
|
|
expect(sender.reload.display_name).to eq 'Totally modified now'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|