about summary refs log tree commit diff
path: root/spec/services
diff options
context:
space:
mode:
authorNick Schonning <nschonni@gmail.com>2023-02-19 23:24:14 -0500
committerGitHub <noreply@github.com>2023-02-20 13:24:14 +0900
commit4552685f6bd400666ec4058783eeabb11568e575 (patch)
treeab708e0d54b9309f96ef0e4d17e8afd32221c5c6 /spec/services
parent4ea1e0fceb0c0c5fee014a99f81f8f13a16f6dde (diff)
Autofix Rubocop RSpec/LeadingSubject (#23670)
Diffstat (limited to 'spec/services')
-rw-r--r--spec/services/activitypub/fetch_featured_collection_service_spec.rb4
-rw-r--r--spec/services/activitypub/fetch_featured_tags_collection_service_spec.rb4
-rw-r--r--spec/services/activitypub/fetch_remote_status_service_spec.rb4
-rw-r--r--spec/services/activitypub/fetch_replies_service_spec.rb4
-rw-r--r--spec/services/activitypub/process_account_service_spec.rb8
-rw-r--r--spec/services/activitypub/process_collection_service_spec.rb4
-rw-r--r--spec/services/activitypub/process_status_update_service_spec.rb4
-rw-r--r--spec/services/activitypub/synchronize_followers_service_spec.rb4
-rw-r--r--spec/services/after_block_domain_from_account_service_spec.rb4
-rw-r--r--spec/services/app_sign_up_service_spec.rb4
-rw-r--r--spec/services/authorize_follow_service_spec.rb4
-rw-r--r--spec/services/block_domain_service_spec.rb4
-rw-r--r--spec/services/block_service_spec.rb4
-rw-r--r--spec/services/clear_domain_media_service_spec.rb4
-rw-r--r--spec/services/delete_account_service_spec.rb4
-rw-r--r--spec/services/fan_out_on_write_service_spec.rb4
-rw-r--r--spec/services/favourite_service_spec.rb4
-rw-r--r--spec/services/fetch_resource_service_spec.rb4
-rw-r--r--spec/services/follow_service_spec.rb4
-rw-r--r--spec/services/process_mentions_service_spec.rb4
-rw-r--r--spec/services/purge_domain_service_spec.rb4
-rw-r--r--spec/services/reblog_service_spec.rb8
-rw-r--r--spec/services/reject_follow_service_spec.rb4
-rw-r--r--spec/services/remove_from_follwers_service_spec.rb4
-rw-r--r--spec/services/report_service_spec.rb12
-rw-r--r--spec/services/suspend_account_service_spec.rb4
-rw-r--r--spec/services/unallow_domain_service_spec.rb4
-rw-r--r--spec/services/unblock_service_spec.rb4
-rw-r--r--spec/services/unfollow_service_spec.rb4
-rw-r--r--spec/services/unsuspend_account_service_spec.rb4
30 files changed, 68 insertions, 68 deletions
diff --git a/spec/services/activitypub/fetch_featured_collection_service_spec.rb b/spec/services/activitypub/fetch_featured_collection_service_spec.rb
index 23d90a9a2..d9266ffc2 100644
--- a/spec/services/activitypub/fetch_featured_collection_service_spec.rb
+++ b/spec/services/activitypub/fetch_featured_collection_service_spec.rb
@@ -1,6 +1,8 @@
 require 'rails_helper'
 
 RSpec.describe ActivityPub::FetchFeaturedCollectionService, type: :service do
+  subject { described_class.new }
+
   let(:actor) { Fabricate(:account, domain: 'example.com', uri: 'https://example.com/account', featured_collection_url: 'https://example.com/account/pinned') }
 
   let!(:known_status) { Fabricate(:status, account: actor, uri: 'https://example.com/account/pinned/1') }
@@ -56,8 +58,6 @@ RSpec.describe ActivityPub::FetchFeaturedCollectionService, type: :service do
     }.with_indifferent_access
   end
 
-  subject { described_class.new }
-
   shared_examples 'sets pinned posts' do
     before do
       stub_request(:get, 'https://example.com/account/pinned/1').to_return(status: 200, body: Oj.dump(status_json_1))
diff --git a/spec/services/activitypub/fetch_featured_tags_collection_service_spec.rb b/spec/services/activitypub/fetch_featured_tags_collection_service_spec.rb
index 692866bce..2110baa2d 100644
--- a/spec/services/activitypub/fetch_featured_tags_collection_service_spec.rb
+++ b/spec/services/activitypub/fetch_featured_tags_collection_service_spec.rb
@@ -1,6 +1,8 @@
 require 'rails_helper'
 
 RSpec.describe ActivityPub::FetchFeaturedTagsCollectionService, type: :service do
+  subject { described_class.new }
+
   let(:collection_url) { 'https://example.com/account/tags' }
   let(:actor) { Fabricate(:account, domain: 'example.com', uri: 'https://example.com/account') }
 
@@ -21,8 +23,6 @@ RSpec.describe ActivityPub::FetchFeaturedTagsCollectionService, type: :service d
     }.with_indifferent_access
   end
 
-  subject { described_class.new }
-
   shared_examples 'sets featured tags' do
     before do
       subject.call(actor, collection_url)
diff --git a/spec/services/activitypub/fetch_remote_status_service_spec.rb b/spec/services/activitypub/fetch_remote_status_service_spec.rb
index 4f3503ac2..6e47392b3 100644
--- a/spec/services/activitypub/fetch_remote_status_service_spec.rb
+++ b/spec/services/activitypub/fetch_remote_status_service_spec.rb
@@ -3,6 +3,8 @@ require 'rails_helper'
 RSpec.describe ActivityPub::FetchRemoteStatusService, type: :service do
   include ActionView::Helpers::TextHelper
 
+  subject { described_class.new }
+
   let!(:sender) { Fabricate(:account, domain: 'foo.bar', uri: 'https://foo.bar') }
   let!(:recipient) { Fabricate(:account) }
 
@@ -18,8 +20,6 @@ RSpec.describe ActivityPub::FetchRemoteStatusService, type: :service do
     }
   end
 
-  subject { described_class.new }
-
   before do
     stub_request(:get, 'https://foo.bar/watch?v=12345').to_return(status: 404, body: '')
     stub_request(:get, object[:id]).to_return(body: Oj.dump(object))
diff --git a/spec/services/activitypub/fetch_replies_service_spec.rb b/spec/services/activitypub/fetch_replies_service_spec.rb
index 5741e0c3f..0231a5e9a 100644
--- a/spec/services/activitypub/fetch_replies_service_spec.rb
+++ b/spec/services/activitypub/fetch_replies_service_spec.rb
@@ -1,6 +1,8 @@
 require 'rails_helper'
 
 RSpec.describe ActivityPub::FetchRepliesService, type: :service do
+  subject { described_class.new }
+
   let(:actor)          { Fabricate(:account, domain: 'example.com', uri: 'http://example.com/account') }
   let(:status)         { Fabricate(:status, account: actor) }
   let(:collection_uri) { 'http://example.com/replies/1' }
@@ -28,8 +30,6 @@ RSpec.describe ActivityPub::FetchRepliesService, type: :service do
     }.with_indifferent_access
   end
 
-  subject { described_class.new }
-
   describe '#call' do
     context 'when the payload is a Collection with inlined replies' do
       context 'when passing the collection itself' do
diff --git a/spec/services/activitypub/process_account_service_spec.rb b/spec/services/activitypub/process_account_service_spec.rb
index d0af7de76..6c3236bae 100644
--- a/spec/services/activitypub/process_account_service_spec.rb
+++ b/spec/services/activitypub/process_account_service_spec.rb
@@ -31,6 +31,8 @@ RSpec.describe ActivityPub::ProcessAccountService, type: :service do
   end
 
   context 'when account is not suspended' do
+    subject { described_class.new.call('alice', 'example.com', payload) }
+
     let!(:account) { Fabricate(:account, username: 'alice', domain: 'example.com') }
 
     let(:payload) do
@@ -46,8 +48,6 @@ RSpec.describe ActivityPub::ProcessAccountService, type: :service do
       allow(Admin::SuspensionWorker).to receive(:perform_async)
     end
 
-    subject { described_class.new.call('alice', 'example.com', payload) }
-
     it 'suspends account remotely' do
       expect(subject.suspended?).to be true
       expect(subject.suspension_origin_remote?).to be true
@@ -60,6 +60,8 @@ RSpec.describe ActivityPub::ProcessAccountService, type: :service do
   end
 
   context 'when account is suspended' do
+    subject { described_class.new.call('alice', 'example.com', payload) }
+
     let!(:account) { Fabricate(:account, username: 'alice', domain: 'example.com', display_name: '') }
 
     let(:payload) do
@@ -78,8 +80,6 @@ RSpec.describe ActivityPub::ProcessAccountService, type: :service do
       account.suspend!(origin: suspension_origin)
     end
 
-    subject { described_class.new.call('alice', 'example.com', payload) }
-
     context 'locally' do
       let(:suspension_origin) { :local }
 
diff --git a/spec/services/activitypub/process_collection_service_spec.rb b/spec/services/activitypub/process_collection_service_spec.rb
index d35d9596d..c7d0bb92a 100644
--- a/spec/services/activitypub/process_collection_service_spec.rb
+++ b/spec/services/activitypub/process_collection_service_spec.rb
@@ -1,6 +1,8 @@
 require 'rails_helper'
 
 RSpec.describe ActivityPub::ProcessCollectionService, type: :service do
+  subject { described_class.new }
+
   let(:actor) { Fabricate(:account, domain: 'example.com', uri: 'http://example.com/account') }
 
   let(:payload) do
@@ -19,8 +21,6 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do
 
   let(:json) { Oj.dump(payload) }
 
-  subject { described_class.new }
-
   describe '#call' do
     context 'when actor is suspended' do
       before do
diff --git a/spec/services/activitypub/process_status_update_service_spec.rb b/spec/services/activitypub/process_status_update_service_spec.rb
index 9a6d75ec0..3d6f76163 100644
--- a/spec/services/activitypub/process_status_update_service_spec.rb
+++ b/spec/services/activitypub/process_status_update_service_spec.rb
@@ -5,6 +5,8 @@ def poll_option_json(name, votes)
 end
 
 RSpec.describe ActivityPub::ProcessStatusUpdateService, type: :service do
+  subject { described_class.new }
+
   let!(:status) { Fabricate(:status, text: 'Hello world', account: Fabricate(:account, domain: 'example.com')) }
   let(:payload) do
     {
@@ -35,8 +37,6 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService, type: :service do
     media_attachments.each { |m| status.media_attachments << m }
   end
 
-  subject { described_class.new }
-
   describe '#call' do
     it 'updates text' do
       subject.call(status, json)
diff --git a/spec/services/activitypub/synchronize_followers_service_spec.rb b/spec/services/activitypub/synchronize_followers_service_spec.rb
index 5a37f0733..0e829a302 100644
--- a/spec/services/activitypub/synchronize_followers_service_spec.rb
+++ b/spec/services/activitypub/synchronize_followers_service_spec.rb
@@ -1,6 +1,8 @@
 require 'rails_helper'
 
 RSpec.describe ActivityPub::SynchronizeFollowersService, type: :service do
+  subject { described_class.new }
+
   let(:actor)          { Fabricate(:account, domain: 'example.com', uri: 'http://example.com/account', inbox_url: 'http://example.com/inbox') }
   let(:alice)          { Fabricate(:account, username: 'alice') }
   let(:bob)            { Fabricate(:account, username: 'bob') }
@@ -25,8 +27,6 @@ RSpec.describe ActivityPub::SynchronizeFollowersService, type: :service do
     }.with_indifferent_access
   end
 
-  subject { described_class.new }
-
   shared_examples 'synchronizes followers' do
     before do
       alice.follow!(actor)
diff --git a/spec/services/after_block_domain_from_account_service_spec.rb b/spec/services/after_block_domain_from_account_service_spec.rb
index 006e3f4d2..9cca82bff 100644
--- a/spec/services/after_block_domain_from_account_service_spec.rb
+++ b/spec/services/after_block_domain_from_account_service_spec.rb
@@ -1,11 +1,11 @@
 require 'rails_helper'
 
 RSpec.describe AfterBlockDomainFromAccountService, type: :service do
+  subject { AfterBlockDomainFromAccountService.new }
+
   let!(:wolf) { Fabricate(:account, username: 'wolf', domain: 'evil.org', inbox_url: 'https://evil.org/inbox', protocol: :activitypub) }
   let!(:alice) { Fabricate(:account, username: 'alice') }
 
-  subject { AfterBlockDomainFromAccountService.new }
-
   before do
     stub_jsonld_contexts!
     allow(ActivityPub::DeliveryWorker).to receive(:perform_async)
diff --git a/spec/services/app_sign_up_service_spec.rb b/spec/services/app_sign_up_service_spec.rb
index 8ec4d4a7a..10da07dcf 100644
--- a/spec/services/app_sign_up_service_spec.rb
+++ b/spec/services/app_sign_up_service_spec.rb
@@ -1,12 +1,12 @@
 require 'rails_helper'
 
 RSpec.describe AppSignUpService, type: :service do
+  subject { described_class.new }
+
   let(:app) { Fabricate(:application, scopes: 'read write') }
   let(:good_params) { { username: 'alice', password: '12345678', email: 'good@email.com', agreement: true } }
   let(:remote_ip) { IPAddr.new('198.0.2.1') }
 
-  subject { described_class.new }
-
   describe '#call' do
     it 'returns nil when registrations are closed' do
       tmp = Setting.registrations_mode
diff --git a/spec/services/authorize_follow_service_spec.rb b/spec/services/authorize_follow_service_spec.rb
index 888d694b6..8f8e44ec7 100644
--- a/spec/services/authorize_follow_service_spec.rb
+++ b/spec/services/authorize_follow_service_spec.rb
@@ -1,10 +1,10 @@
 require 'rails_helper'
 
 RSpec.describe AuthorizeFollowService, type: :service do
-  let(:sender) { Fabricate(:account, username: 'alice') }
-
   subject { AuthorizeFollowService.new }
 
+  let(:sender) { Fabricate(:account, username: 'alice') }
+
   describe 'local' do
     let(:bob) { Fabricate(:account, username: 'bob') }
 
diff --git a/spec/services/block_domain_service_spec.rb b/spec/services/block_domain_service_spec.rb
index e24e48d41..56b3a5ad1 100644
--- a/spec/services/block_domain_service_spec.rb
+++ b/spec/services/block_domain_service_spec.rb
@@ -1,14 +1,14 @@
 require 'rails_helper'
 
 RSpec.describe BlockDomainService, type: :service do
+  subject { BlockDomainService.new }
+
   let!(:bad_account) { Fabricate(:account, username: 'badguy666', domain: 'evil.org') }
   let!(:bad_status1) { Fabricate(:status, account: bad_account, text: 'You suck') }
   let!(:bad_status2) { Fabricate(:status, account: bad_account, text: 'Hahaha') }
   let!(:bad_attachment) { Fabricate(:media_attachment, account: bad_account, status: bad_status2, file: attachment_fixture('attachment.jpg')) }
   let!(:already_banned_account) { Fabricate(:account, username: 'badguy', domain: 'evil.org', suspended: true, silenced: true) }
 
-  subject { BlockDomainService.new }
-
   describe 'for a suspension' do
     before do
       subject.call(DomainBlock.create!(domain: 'evil.org', severity: :suspend))
diff --git a/spec/services/block_service_spec.rb b/spec/services/block_service_spec.rb
index a53e1f928..049644dbc 100644
--- a/spec/services/block_service_spec.rb
+++ b/spec/services/block_service_spec.rb
@@ -1,10 +1,10 @@
 require 'rails_helper'
 
 RSpec.describe BlockService, type: :service do
-  let(:sender) { Fabricate(:account, username: 'alice') }
-
   subject { BlockService.new }
 
+  let(:sender) { Fabricate(:account, username: 'alice') }
+
   describe 'local' do
     let(:bob) { Fabricate(:account, username: 'bob') }
 
diff --git a/spec/services/clear_domain_media_service_spec.rb b/spec/services/clear_domain_media_service_spec.rb
index e90faf84d..993ba789e 100644
--- a/spec/services/clear_domain_media_service_spec.rb
+++ b/spec/services/clear_domain_media_service_spec.rb
@@ -1,13 +1,13 @@
 require 'rails_helper'
 
 RSpec.describe ClearDomainMediaService, type: :service do
+  subject { ClearDomainMediaService.new }
+
   let!(:bad_account) { Fabricate(:account, username: 'badguy666', domain: 'evil.org') }
   let!(:bad_status1) { Fabricate(:status, account: bad_account, text: 'You suck') }
   let!(:bad_status2) { Fabricate(:status, account: bad_account, text: 'Hahaha') }
   let!(:bad_attachment) { Fabricate(:media_attachment, account: bad_account, status: bad_status2, file: attachment_fixture('attachment.jpg')) }
 
-  subject { ClearDomainMediaService.new }
-
   describe 'for a silence with reject media' do
     before do
       subject.call(DomainBlock.create!(domain: 'evil.org', severity: :silence, reject_media: true))
diff --git a/spec/services/delete_account_service_spec.rb b/spec/services/delete_account_service_spec.rb
index cc4b168fc..d0cc8d288 100644
--- a/spec/services/delete_account_service_spec.rb
+++ b/spec/services/delete_account_service_spec.rb
@@ -2,6 +2,8 @@ require 'rails_helper'
 
 RSpec.describe DeleteAccountService, type: :service do
   shared_examples 'common behavior' do
+    subject { described_class.new.call(account) }
+
     let!(:status) { Fabricate(:status, account: account) }
     let!(:mention) { Fabricate(:mention, account: local_follower) }
     let!(:status_with_mention) { Fabricate(:status, account: account, mentions: [mention]) }
@@ -23,8 +25,6 @@ RSpec.describe DeleteAccountService, type: :service do
 
     let!(:account_note) { Fabricate(:account_note, account: account) }
 
-    subject { described_class.new.call(account) }
-
     it 'deletes associated owned records' do
       expect { subject }.to change {
         [
diff --git a/spec/services/fan_out_on_write_service_spec.rb b/spec/services/fan_out_on_write_service_spec.rb
index 3c294cf95..d09750dd2 100644
--- a/spec/services/fan_out_on_write_service_spec.rb
+++ b/spec/services/fan_out_on_write_service_spec.rb
@@ -1,6 +1,8 @@
 require 'rails_helper'
 
 RSpec.describe FanOutOnWriteService, type: :service do
+  subject { described_class.new }
+
   let(:last_active_at) { Time.now.utc }
   let(:status) { Fabricate(:status, account: alice, visibility: visibility, text: 'Hello @bob #hoge') }
 
@@ -8,8 +10,6 @@ RSpec.describe FanOutOnWriteService, type: :service do
   let!(:bob)   { Fabricate(:user, current_sign_in_at: last_active_at, account_attributes: { username: 'bob' }).account }
   let!(:tom)   { Fabricate(:user, current_sign_in_at: last_active_at).account }
 
-  subject { described_class.new }
-
   before do
     bob.follow!(alice)
     tom.follow!(alice)
diff --git a/spec/services/favourite_service_spec.rb b/spec/services/favourite_service_spec.rb
index 8703c2af8..4f621200a 100644
--- a/spec/services/favourite_service_spec.rb
+++ b/spec/services/favourite_service_spec.rb
@@ -1,10 +1,10 @@
 require 'rails_helper'
 
 RSpec.describe FavouriteService, type: :service do
-  let(:sender) { Fabricate(:account, username: 'alice') }
-
   subject { FavouriteService.new }
 
+  let(:sender) { Fabricate(:account, username: 'alice') }
+
   describe 'local' do
     let(:bob)    { Fabricate(:account) }
     let(:status) { Fabricate(:status, account: bob) }
diff --git a/spec/services/fetch_resource_service_spec.rb b/spec/services/fetch_resource_service_spec.rb
index c39f52632..84c4035cb 100644
--- a/spec/services/fetch_resource_service_spec.rb
+++ b/spec/services/fetch_resource_service_spec.rb
@@ -2,10 +2,10 @@ require 'rails_helper'
 
 RSpec.describe FetchResourceService, type: :service do
   describe '#call' do
-    let(:url) { 'http://example.com' }
-
     subject { described_class.new.call(url) }
 
+    let(:url) { 'http://example.com' }
+
     context 'with blank url' do
       let(:url) { '' }
 
diff --git a/spec/services/follow_service_spec.rb b/spec/services/follow_service_spec.rb
index 59073c27f..f95d59440 100644
--- a/spec/services/follow_service_spec.rb
+++ b/spec/services/follow_service_spec.rb
@@ -1,10 +1,10 @@
 require 'rails_helper'
 
 RSpec.describe FollowService, type: :service do
-  let(:sender) { Fabricate(:account, username: 'alice') }
-
   subject { FollowService.new }
 
+  let(:sender) { Fabricate(:account, username: 'alice') }
+
   context 'local account' do
     describe 'locked account' do
       let(:bob) { Fabricate(:account, locked: true, username: 'bob') }
diff --git a/spec/services/process_mentions_service_spec.rb b/spec/services/process_mentions_service_spec.rb
index 6a16928e0..79ccfa322 100644
--- a/spec/services/process_mentions_service_spec.rb
+++ b/spec/services/process_mentions_service_spec.rb
@@ -1,10 +1,10 @@
 require 'rails_helper'
 
 RSpec.describe ProcessMentionsService, type: :service do
-  let(:account) { Fabricate(:account, username: 'alice') }
-
   subject { ProcessMentionsService.new }
 
+  let(:account) { Fabricate(:account, username: 'alice') }
+
   context 'when mentions contain blocked accounts' do
     let(:non_blocked_account)          { Fabricate(:account) }
     let(:individually_blocked_account) { Fabricate(:account) }
diff --git a/spec/services/purge_domain_service_spec.rb b/spec/services/purge_domain_service_spec.rb
index 59285f126..7d8969ee8 100644
--- a/spec/services/purge_domain_service_spec.rb
+++ b/spec/services/purge_domain_service_spec.rb
@@ -1,13 +1,13 @@
 require 'rails_helper'
 
 RSpec.describe PurgeDomainService, type: :service do
+  subject { PurgeDomainService.new }
+
   let!(:old_account) { Fabricate(:account, domain: 'obsolete.org') }
   let!(:old_status1) { Fabricate(:status, account: old_account) }
   let!(:old_status2) { Fabricate(:status, account: old_account) }
   let!(:old_attachment) { Fabricate(:media_attachment, account: old_account, status: old_status2, file: attachment_fixture('attachment.jpg')) }
 
-  subject { PurgeDomainService.new }
-
   describe 'for a suspension' do
     before do
       subject.call('obsolete.org')
diff --git a/spec/services/reblog_service_spec.rb b/spec/services/reblog_service_spec.rb
index c0ae5eedc..e2ac0154c 100644
--- a/spec/services/reblog_service_spec.rb
+++ b/spec/services/reblog_service_spec.rb
@@ -4,12 +4,12 @@ RSpec.describe ReblogService, type: :service do
   let(:alice)  { Fabricate(:account, username: 'alice') }
 
   context 'creates a reblog with appropriate visibility' do
+    subject { ReblogService.new }
+
     let(:visibility)        { :public }
     let(:reblog_visibility) { :public }
     let(:status)            { Fabricate(:status, account: alice, visibility: visibility) }
 
-    subject { ReblogService.new }
-
     before do
       subject.call(alice, status, visibility: reblog_visibility)
     end
@@ -45,11 +45,11 @@ RSpec.describe ReblogService, type: :service do
   end
 
   context 'ActivityPub' do
+    subject { ReblogService.new }
+
     let(:bob)    { Fabricate(:account, username: 'bob', protocol: :activitypub, domain: 'example.com', inbox_url: 'http://example.com/inbox') }
     let(:status) { Fabricate(:status, account: bob) }
 
-    subject { ReblogService.new }
-
     before do
       stub_request(:post, bob.inbox_url)
       allow(ActivityPub::DistributionWorker).to receive(:perform_async)
diff --git a/spec/services/reject_follow_service_spec.rb b/spec/services/reject_follow_service_spec.rb
index e14bfa78d..97b7412b9 100644
--- a/spec/services/reject_follow_service_spec.rb
+++ b/spec/services/reject_follow_service_spec.rb
@@ -1,10 +1,10 @@
 require 'rails_helper'
 
 RSpec.describe RejectFollowService, type: :service do
-  let(:sender) { Fabricate(:account, username: 'alice') }
-
   subject { RejectFollowService.new }
 
+  let(:sender) { Fabricate(:account, username: 'alice') }
+
   describe 'local' do
     let(:bob) { Fabricate(:account) }
 
diff --git a/spec/services/remove_from_follwers_service_spec.rb b/spec/services/remove_from_follwers_service_spec.rb
index 9b9c846cf..782f859e2 100644
--- a/spec/services/remove_from_follwers_service_spec.rb
+++ b/spec/services/remove_from_follwers_service_spec.rb
@@ -1,10 +1,10 @@
 require 'rails_helper'
 
 RSpec.describe RemoveFromFollowersService, type: :service do
-  let(:bob) { Fabricate(:account, username: 'bob') }
-
   subject { RemoveFromFollowersService.new }
 
+  let(:bob) { Fabricate(:account, username: 'bob') }
+
   describe 'local' do
     let(:sender) { Fabricate(:account, username: 'alice') }
 
diff --git a/spec/services/report_service_spec.rb b/spec/services/report_service_spec.rb
index 02bc42ac1..c3a3fddf8 100644
--- a/spec/services/report_service_spec.rb
+++ b/spec/services/report_service_spec.rb
@@ -29,13 +29,13 @@ RSpec.describe ReportService, type: :service do
   end
 
   context 'when the reported status is a DM' do
-    let(:target_account) { Fabricate(:account) }
-    let(:status) { Fabricate(:status, account: target_account, visibility: :direct) }
-
     subject do
       -> { described_class.new.call(source_account, target_account, status_ids: [status.id]) }
     end
 
+    let(:target_account) { Fabricate(:account) }
+    let(:status) { Fabricate(:status, account: target_account, visibility: :direct) }
+
     context 'when it is addressed to the reporter' do
       before do
         status.mentions.create(account: source_account)
@@ -85,13 +85,13 @@ RSpec.describe ReportService, type: :service do
   end
 
   context 'when other reports already exist for the same target' do
-    let!(:target_account) { Fabricate(:account) }
-    let!(:other_report)   { Fabricate(:report, target_account: target_account) }
-
     subject do
       -> {  described_class.new.call(source_account, target_account) }
     end
 
+    let!(:target_account) { Fabricate(:account) }
+    let!(:other_report)   { Fabricate(:report, target_account: target_account) }
+
     before do
       ActionMailer::Base.deliveries.clear
       source_account.user.settings.notification_emails['report'] = true
diff --git a/spec/services/suspend_account_service_spec.rb b/spec/services/suspend_account_service_spec.rb
index 126b13986..5701090b3 100644
--- a/spec/services/suspend_account_service_spec.rb
+++ b/spec/services/suspend_account_service_spec.rb
@@ -2,11 +2,11 @@ require 'rails_helper'
 
 RSpec.describe SuspendAccountService, type: :service do
   shared_examples 'common behavior' do
+    subject { described_class.new.call(account) }
+
     let!(:local_follower) { Fabricate(:user, current_sign_in_at: 1.hour.ago).account }
     let!(:list)           { Fabricate(:list, account: local_follower) }
 
-    subject { described_class.new.call(account) }
-
     before do
       allow(FeedManager.instance).to receive(:unmerge_from_home).and_return(nil)
       allow(FeedManager.instance).to receive(:unmerge_from_list).and_return(nil)
diff --git a/spec/services/unallow_domain_service_spec.rb b/spec/services/unallow_domain_service_spec.rb
index b93945b9a..ae7d00c7d 100644
--- a/spec/services/unallow_domain_service_spec.rb
+++ b/spec/services/unallow_domain_service_spec.rb
@@ -1,6 +1,8 @@
 require 'rails_helper'
 
 RSpec.describe UnallowDomainService, type: :service do
+  subject { UnallowDomainService.new }
+
   let!(:bad_account) { Fabricate(:account, username: 'badguy666', domain: 'evil.org') }
   let!(:bad_status1) { Fabricate(:status, account: bad_account, text: 'You suck') }
   let!(:bad_status2) { Fabricate(:status, account: bad_account, text: 'Hahaha') }
@@ -8,8 +10,6 @@ RSpec.describe UnallowDomainService, type: :service do
   let!(:already_banned_account) { Fabricate(:account, username: 'badguy', domain: 'evil.org', suspended: true, silenced: true) }
   let!(:domain_allow) { Fabricate(:domain_allow, domain: 'evil.org') }
 
-  subject { UnallowDomainService.new }
-
   context 'in limited federation mode' do
     before do
       allow(subject).to receive(:whitelist_mode?).and_return(true)
diff --git a/spec/services/unblock_service_spec.rb b/spec/services/unblock_service_spec.rb
index 10448b340..bd24005f6 100644
--- a/spec/services/unblock_service_spec.rb
+++ b/spec/services/unblock_service_spec.rb
@@ -1,10 +1,10 @@
 require 'rails_helper'
 
 RSpec.describe UnblockService, type: :service do
-  let(:sender) { Fabricate(:account, username: 'alice') }
-
   subject { UnblockService.new }
 
+  let(:sender) { Fabricate(:account, username: 'alice') }
+
   describe 'local' do
     let(:bob) { Fabricate(:account) }
 
diff --git a/spec/services/unfollow_service_spec.rb b/spec/services/unfollow_service_spec.rb
index bb5bef5c9..55969bef9 100644
--- a/spec/services/unfollow_service_spec.rb
+++ b/spec/services/unfollow_service_spec.rb
@@ -1,10 +1,10 @@
 require 'rails_helper'
 
 RSpec.describe UnfollowService, type: :service do
-  let(:sender) { Fabricate(:account, username: 'alice') }
-
   subject { UnfollowService.new }
 
+  let(:sender) { Fabricate(:account, username: 'alice') }
+
   describe 'local' do
     let(:bob) { Fabricate(:account, username: 'bob') }
 
diff --git a/spec/services/unsuspend_account_service_spec.rb b/spec/services/unsuspend_account_service_spec.rb
index 987eb09e2..667507469 100644
--- a/spec/services/unsuspend_account_service_spec.rb
+++ b/spec/services/unsuspend_account_service_spec.rb
@@ -2,11 +2,11 @@ require 'rails_helper'
 
 RSpec.describe UnsuspendAccountService, type: :service do
   shared_examples 'common behavior' do
+    subject { described_class.new.call(account) }
+
     let!(:local_follower) { Fabricate(:user, current_sign_in_at: 1.hour.ago).account }
     let!(:list)           { Fabricate(:list, account: local_follower) }
 
-    subject { described_class.new.call(account) }
-
     before do
       allow(FeedManager.instance).to receive(:merge_into_home).and_return(nil)
       allow(FeedManager.instance).to receive(:merge_into_list).and_return(nil)