diff options
author | Claire <claire.github-309c@sitedethib.com> | 2021-10-25 20:28:51 +0200 |
---|---|---|
committer | Claire <claire.github-309c@sitedethib.com> | 2021-10-25 20:28:51 +0200 |
commit | e855df149bd2f19729af48cd5f452fa3972273f8 (patch) | |
tree | 4d9dab4fd4568f67b07642db61a2f382e8b1dcc0 /spec/services/activitypub | |
parent | c647fa99cab9b9db81d36223cf2c2c27e065b648 (diff) | |
parent | 5ba46952af87e42a64962a34f7ec43bc710bdcaf (diff) |
Merge branch 'main' into glitch-soc/merge-upstream
Conflicts: - `.env.production.sample`: Upstream added new configuration options, uncommented by default. Commented them. - `Gemfile.lock`: Upstream updated dependencies textually close to glitch-soc-specific dependencies. Updated those upstream dependencies.
Diffstat (limited to 'spec/services/activitypub')
-rw-r--r-- | spec/services/activitypub/fetch_remote_status_service_spec.rb | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/spec/services/activitypub/fetch_remote_status_service_spec.rb b/spec/services/activitypub/fetch_remote_status_service_spec.rb index 1ecc46952..ceba5f210 100644 --- a/spec/services/activitypub/fetch_remote_status_service_spec.rb +++ b/spec/services/activitypub/fetch_remote_status_service_spec.rb @@ -145,5 +145,46 @@ RSpec.describe ActivityPub::FetchRemoteStatusService, type: :service do expect(sender.statuses.first).to be_nil end end + + context 'with a valid Create activity' do + let(:object) do + { + '@context': 'https://www.w3.org/ns/activitystreams', + id: "https://#{valid_domain}/@foo/1234/create", + type: 'Create', + actor: ActivityPub::TagManager.instance.uri_for(sender), + object: note, + } + end + + it 'creates status' do + status = sender.statuses.first + + expect(status).to_not be_nil + expect(status.uri).to eq note[:id] + expect(status.text).to eq note[:content] + end + end + + context 'with a Create activity with a mismatching id' do + let(:object) do + { + '@context': 'https://www.w3.org/ns/activitystreams', + id: "https://#{valid_domain}/@foo/1234/create", + type: 'Create', + actor: ActivityPub::TagManager.instance.uri_for(sender), + object: { + id: "https://real.address/@foo/1234", + type: 'Note', + content: 'Lorem ipsum', + attributedTo: ActivityPub::TagManager.instance.uri_for(sender), + }, + } + end + + it 'does not create status' do + expect(sender.statuses.first).to be_nil + end + end end end |