about summary refs log tree commit diff
path: root/spec/lib/activitypub/activity/create_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/activitypub/activity/create_spec.rb')
-rw-r--r--spec/lib/activitypub/activity/create_spec.rb46
1 files changed, 21 insertions, 25 deletions
diff --git a/spec/lib/activitypub/activity/create_spec.rb b/spec/lib/activitypub/activity/create_spec.rb
index 132e0c31c..ddbdb07aa 100644
--- a/spec/lib/activitypub/activity/create_spec.rb
+++ b/spec/lib/activitypub/activity/create_spec.rb
@@ -753,10 +753,6 @@ RSpec.describe ActivityPub::Activity::Create do
 
     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(:object_json) do
         {
           id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
@@ -778,6 +774,9 @@ RSpec.describe ActivityPub::Activity::Create do
           },
         }
       end
+      let(:target_device) { Fabricate(:device, account: recipient) }
+
+      subject { described_class.new(json, sender, delivery: true, delivered_to_account_id: recipient.id) }
 
       before do
         subject.perform
@@ -833,13 +832,6 @@ RSpec.describe ActivityPub::Activity::Create do
 
     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(:object_json) do
         {
           id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
@@ -849,6 +841,12 @@ RSpec.describe ActivityPub::Activity::Create do
         }
       end
 
+      subject { described_class.new(json, sender, delivery: true) }
+
+      before do
+        subject.perform
+      end
+
       it 'creates status' do
         status = sender.statuses.first
 
@@ -859,13 +857,6 @@ RSpec.describe ActivityPub::Activity::Create do
 
     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(:object_json) do
         {
           id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
@@ -875,6 +866,12 @@ RSpec.describe ActivityPub::Activity::Create do
         }
       end
 
+      subject { described_class.new(json, sender, delivery: true) }
+
+      before do
+        subject.perform
+      end
+
       it 'creates status' do
         status = sender.statuses.first
 
@@ -885,13 +882,6 @@ RSpec.describe ActivityPub::Activity::Create do
 
     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(:object_json) do
         {
           id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
@@ -901,6 +891,12 @@ RSpec.describe ActivityPub::Activity::Create do
         }
       end
 
+      subject { described_class.new(json, sender, delivery: true) }
+
+      before do
+        subject.perform
+      end
+
       it 'creates status' do
         status = sender.statuses.first