about summary refs log tree commit diff
path: root/spec/lib/activitypub/activity
diff options
context:
space:
mode:
authorNick Schonning <nschonni@gmail.com>2023-02-19 21:17:41 -0500
committerGitHub <noreply@github.com>2023-02-20 11:17:41 +0900
commit5179c47087e7807162f1466ec61a797586de007f (patch)
tree106d584a459714b39a3b2fe1a87492fa2cdedc74 /spec/lib/activitypub/activity
parentaef0051fd0723ff03175a8851497056ed07d1a83 (diff)
Autofix Rubocops RSpec/ScatteredLet (#23725)
Diffstat (limited to 'spec/lib/activitypub/activity')
-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