diff options
Diffstat (limited to 'spec/lib/activitypub/activity/create_spec.rb')
-rw-r--r-- | spec/lib/activitypub/activity/create_spec.rb | 59 |
1 files changed, 28 insertions, 31 deletions
diff --git a/spec/lib/activitypub/activity/create_spec.rb b/spec/lib/activitypub/activity/create_spec.rb index 738e644c5..1226cfd8e 100644 --- a/spec/lib/activitypub/activity/create_spec.rb +++ b/spec/lib/activitypub/activity/create_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'rails_helper' RSpec.describe ActivityPub::Activity::Create do @@ -51,7 +53,7 @@ RSpec.describe ActivityPub::Activity::Create do status = sender.statuses.first expect(status).to_not be_nil - expect(status.edited?).to eq true + expect(status.edited?).to be true end end @@ -77,7 +79,7 @@ RSpec.describe ActivityPub::Activity::Create do status = sender.statuses.first expect(status).to_not be_nil - expect(status.edited?).to eq false + expect(status.edited?).to be false end end @@ -252,10 +254,10 @@ RSpec.describe ActivityPub::Activity::Create do type: 'Note', content: 'Lorem ipsum', to: { - 'type': 'OrderedCollection', - 'id': 'http://example.com/followers', - 'first': 'http://example.com/followers?page=true', - } + type: 'OrderedCollection', + id: 'http://example.com/followers', + first: 'http://example.com/followers?page=true', + }, } end @@ -454,7 +456,6 @@ RSpec.describe ActivityPub::Activity::Create do end end - context 'with media attachments with long description' do let(:object_json) do { @@ -733,7 +734,7 @@ RSpec.describe ActivityPub::Activity::Create do replies: { type: 'Collection', totalItems: 3, - } + }, }, ], } @@ -763,7 +764,7 @@ RSpec.describe ActivityPub::Activity::Create do id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join, type: 'Note', name: 'Yellow', - inReplyTo: ActivityPub::TagManager.instance.uri_for(local_status) + inReplyTo: ActivityPub::TagManager.instance.uri_for(local_status), } end @@ -788,7 +789,7 @@ RSpec.describe ActivityPub::Activity::Create do id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join, type: 'Note', name: 'Yellow', - inReplyTo: ActivityPub::TagManager.instance.uri_for(local_status) + inReplyTo: ActivityPub::TagManager.instance.uri_for(local_status), } end @@ -799,11 +800,9 @@ RSpec.describe ActivityPub::Activity::Create do end context 'with an encrypted message' do - let(:recipient) { Fabricate(:account) } - let(:target_device) { Fabricate(:device, account: recipient) } - subject { described_class.new(json, sender, delivery: true, delivered_to_account_id: recipient.id) } + let(:recipient) { Fabricate(:account) } let(:object_json) do { id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join, @@ -825,6 +824,7 @@ RSpec.describe ActivityPub::Activity::Create do }, } end + let(:target_device) { Fabricate(:device, account: recipient) } before do subject.perform @@ -879,14 +879,9 @@ RSpec.describe ActivityPub::Activity::Create do end context 'when sender replies to local status' do - let!(:local_status) { Fabricate(:status) } - subject { described_class.new(json, sender, delivery: true) } - before do - subject.perform - end - + let!(:local_status) { Fabricate(:status) } let(:object_json) do { id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join, @@ -896,6 +891,10 @@ RSpec.describe ActivityPub::Activity::Create do } end + before do + subject.perform + end + it 'creates status' do status = sender.statuses.first @@ -905,14 +904,9 @@ RSpec.describe ActivityPub::Activity::Create do end context 'when sender targets a local user' do - let!(:local_account) { Fabricate(:account) } - subject { described_class.new(json, sender, delivery: true) } - before do - subject.perform - end - + let!(:local_account) { Fabricate(:account) } let(:object_json) do { id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join, @@ -922,6 +916,10 @@ RSpec.describe ActivityPub::Activity::Create do } end + before do + subject.perform + end + it 'creates status' do status = sender.statuses.first @@ -931,14 +929,9 @@ RSpec.describe ActivityPub::Activity::Create do end context 'when sender cc\'s a local user' do - let!(:local_account) { Fabricate(:account) } - subject { described_class.new(json, sender, delivery: true) } - before do - subject.perform - end - + let!(:local_account) { Fabricate(:account) } let(:object_json) do { id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join, @@ -948,6 +941,10 @@ RSpec.describe ActivityPub::Activity::Create do } end + before do + subject.perform + end + it 'creates status' do status = sender.statuses.first |