about summary refs log tree commit diff
path: root/spec/services
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2023-02-26 15:06:03 +0100
committerGitHub <noreply@github.com>2023-02-26 15:06:03 +0100
commit6a4be4e96677eb3e1303ddcab8f8b4bea7298453 (patch)
tree52627bf6dd64b0a33e280442b2de60b4e802a544 /spec/services
parent45087c1092143e95dfcc85b6c9abc5c6c0a0a5c2 (diff)
parentb91756fd4d475edff890e460c44b3a7245ad51e2 (diff)
Merge pull request #2119 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'spec/services')
-rw-r--r--spec/services/account_search_service_spec.rb4
-rw-r--r--spec/services/account_statuses_cleanup_service_spec.rb2
-rw-r--r--spec/services/activitypub/fetch_featured_collection_service_spec.rb6
-rw-r--r--spec/services/activitypub/fetch_featured_tags_collection_service_spec.rb8
-rw-r--r--spec/services/activitypub/fetch_remote_account_service_spec.rb2
-rw-r--r--spec/services/activitypub/fetch_remote_actor_service_spec.rb2
-rw-r--r--spec/services/activitypub/fetch_remote_key_service_spec.rb2
-rw-r--r--spec/services/activitypub/fetch_remote_status_service_spec.rb6
-rw-r--r--spec/services/activitypub/fetch_replies_service_spec.rb6
-rw-r--r--spec/services/activitypub/process_account_service_spec.rb12
-rw-r--r--spec/services/activitypub/process_collection_service_spec.rb16
-rw-r--r--spec/services/activitypub/process_status_update_service_spec.rb38
-rw-r--r--spec/services/activitypub/synchronize_followers_service_spec.rb6
-rw-r--r--spec/services/after_block_domain_from_account_service_spec.rb6
-rw-r--r--spec/services/after_block_service_spec.rb2
-rw-r--r--spec/services/app_sign_up_service_spec.rb6
-rw-r--r--spec/services/authorize_follow_service_spec.rb6
-rw-r--r--spec/services/batched_remove_status_service_spec.rb2
-rw-r--r--spec/services/block_domain_service_spec.rb12
-rw-r--r--spec/services/block_service_spec.rb6
-rw-r--r--spec/services/bootstrap_timeline_service_spec.rb2
-rw-r--r--spec/services/clear_domain_media_service_spec.rb12
-rw-r--r--spec/services/delete_account_service_spec.rb12
-rw-r--r--spec/services/fan_out_on_write_service_spec.rb9
-rw-r--r--spec/services/favourite_service_spec.rb6
-rw-r--r--spec/services/fetch_link_card_service_spec.rb2
-rw-r--r--spec/services/fetch_oembed_service_spec.rb6
-rw-r--r--spec/services/fetch_remote_status_service_spec.rb3
-rw-r--r--spec/services/fetch_resource_service_spec.rb8
-rw-r--r--spec/services/follow_service_spec.rb6
-rw-r--r--spec/services/import_service_spec.rb16
-rw-r--r--spec/services/mute_service_spec.rb2
-rw-r--r--spec/services/notify_service_spec.rb2
-rw-r--r--spec/services/post_status_service_spec.rb8
-rw-r--r--spec/services/precompute_feed_service_spec.rb2
-rw-r--r--spec/services/process_mentions_service_spec.rb6
-rw-r--r--spec/services/purge_domain_service_spec.rb6
-rw-r--r--spec/services/reblog_service_spec.rb10
-rw-r--r--spec/services/reject_follow_service_spec.rb6
-rw-r--r--spec/services/remove_from_followers_service_spec.rb (renamed from spec/services/remove_from_follwers_service_spec.rb)6
-rw-r--r--spec/services/remove_status_service_spec.rb2
-rw-r--r--spec/services/report_service_spec.rb14
-rw-r--r--spec/services/resolve_account_service_spec.rb14
-rw-r--r--spec/services/search_service_spec.rb6
-rw-r--r--spec/services/suspend_account_service_spec.rb6
-rw-r--r--spec/services/unallow_domain_service_spec.rb6
-rw-r--r--spec/services/unblock_service_spec.rb6
-rw-r--r--spec/services/unfollow_service_spec.rb6
-rw-r--r--spec/services/unmute_service_spec.rb2
-rw-r--r--spec/services/unsuspend_account_service_spec.rb6
-rw-r--r--spec/services/update_account_service_spec.rb2
-rw-r--r--spec/services/update_status_service_spec.rb2
-rw-r--r--spec/services/verify_link_service_spec.rb2
53 files changed, 225 insertions, 129 deletions
diff --git a/spec/services/account_search_service_spec.rb b/spec/services/account_search_service_spec.rb
index d3b5baad6..bb819bb6c 100644
--- a/spec/services/account_search_service_spec.rb
+++ b/spec/services/account_search_service_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 describe AccountSearchService, type: :service do
@@ -63,7 +65,7 @@ describe AccountSearchService, type: :service do
         allow(ResolveAccountService).to receive(:new).and_return(service)
 
         results = subject.call('newuser@remote.com', nil, limit: 10, resolve: false)
-        expect(service).not_to have_received(:call)
+        expect(service).to_not have_received(:call)
       end
     end
 
diff --git a/spec/services/account_statuses_cleanup_service_spec.rb b/spec/services/account_statuses_cleanup_service_spec.rb
index a30e14ab6..e83063f73 100644
--- a/spec/services/account_statuses_cleanup_service_spec.rb
+++ b/spec/services/account_statuses_cleanup_service_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 describe AccountStatusesCleanupService, type: :service do
diff --git a/spec/services/activitypub/fetch_featured_collection_service_spec.rb b/spec/services/activitypub/fetch_featured_collection_service_spec.rb
index 23d90a9a2..59d332599 100644
--- a/spec/services/activitypub/fetch_featured_collection_service_spec.rb
+++ b/spec/services/activitypub/fetch_featured_collection_service_spec.rb
@@ -1,6 +1,10 @@
+# frozen_string_literal: true
+
 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 +60,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..071e4d92d 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,10 @@
+# frozen_string_literal: true
+
 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,15 +25,13 @@ 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)
     end
 
     it 'sets expected tags as pinned tags' do
-      expect(actor.featured_tags.map(&:display_name)).to match_array ['Foo', 'bar', 'baZ']
+      expect(actor.featured_tags.map(&:display_name)).to match_array %w(Foo bar baZ)
     end
   end
 
diff --git a/spec/services/activitypub/fetch_remote_account_service_spec.rb b/spec/services/activitypub/fetch_remote_account_service_spec.rb
index ec6f1f41d..868bc2a58 100644
--- a/spec/services/activitypub/fetch_remote_account_service_spec.rb
+++ b/spec/services/activitypub/fetch_remote_account_service_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe ActivityPub::FetchRemoteAccountService, type: :service do
diff --git a/spec/services/activitypub/fetch_remote_actor_service_spec.rb b/spec/services/activitypub/fetch_remote_actor_service_spec.rb
index 20117c66d..a72c6941e 100644
--- a/spec/services/activitypub/fetch_remote_actor_service_spec.rb
+++ b/spec/services/activitypub/fetch_remote_actor_service_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe ActivityPub::FetchRemoteActorService, type: :service do
diff --git a/spec/services/activitypub/fetch_remote_key_service_spec.rb b/spec/services/activitypub/fetch_remote_key_service_spec.rb
index 3186c4270..0ec0c2736 100644
--- a/spec/services/activitypub/fetch_remote_key_service_spec.rb
+++ b/spec/services/activitypub/fetch_remote_key_service_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe ActivityPub::FetchRemoteKeyService, type: :service do
diff --git a/spec/services/activitypub/fetch_remote_status_service_spec.rb b/spec/services/activitypub/fetch_remote_status_service_spec.rb
index 4f3503ac2..1c39db21f 100644
--- a/spec/services/activitypub/fetch_remote_status_service_spec.rb
+++ b/spec/services/activitypub/fetch_remote_status_service_spec.rb
@@ -1,8 +1,12 @@
+# frozen_string_literal: true
+
 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 +22,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..bf8e29676 100644
--- a/spec/services/activitypub/fetch_replies_service_spec.rb
+++ b/spec/services/activitypub/fetch_replies_service_spec.rb
@@ -1,6 +1,10 @@
+# frozen_string_literal: true
+
 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 +32,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..491b8ed5a 100644
--- a/spec/services/activitypub/process_account_service_spec.rb
+++ b/spec/services/activitypub/process_account_service_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe ActivityPub::ProcessAccountService, type: :service do
@@ -12,7 +14,7 @@ RSpec.describe ActivityPub::ProcessAccountService, type: :service do
         attachment: [
           { type: 'PropertyValue', name: 'Pronouns', value: 'They/them' },
           { type: 'PropertyValue', name: 'Occupation', value: 'Unit test' },
-          { type: 'PropertyValue', name: 'non-string', value: ['foo', 'bar'] },
+          { type: 'PropertyValue', name: 'non-string', value: %w(foo bar) },
         ],
       }.with_indifferent_access
     end
@@ -31,6 +33,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 +50,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 +62,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 +82,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 fbfa6d6c6..1433d0c50 100644
--- a/spec/services/activitypub/process_collection_service_spec.rb
+++ b/spec/services/activitypub/process_collection_service_spec.rb
@@ -1,6 +1,10 @@
+# frozen_string_literal: true
+
 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 +23,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
@@ -39,7 +41,7 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do
           end
 
           it 'does not process payload' do
-            expect(ActivityPub::Activity).not_to receive(:factory)
+            expect(ActivityPub::Activity).to_not receive(:factory)
             subject.call(json, actor)
           end
         end
@@ -69,7 +71,7 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do
 
       it 'does not process payload if no signature exists' do
         expect_any_instance_of(ActivityPub::LinkedDataSignature).to receive(:verify_actor!).and_return(nil)
-        expect(ActivityPub::Activity).not_to receive(:factory)
+        expect(ActivityPub::Activity).to_not receive(:factory)
 
         subject.call(json, forwarder)
       end
@@ -87,7 +89,7 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do
         payload['signature'] = { 'type' => 'RsaSignature2017' }
 
         expect_any_instance_of(ActivityPub::LinkedDataSignature).to receive(:verify_actor!).and_return(nil)
-        expect(ActivityPub::Activity).not_to receive(:factory)
+        expect(ActivityPub::Activity).to_not receive(:factory)
 
         subject.call(json, forwarder)
       end
@@ -206,7 +208,7 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do
         end
 
         it 'does not process forged payload' do
-          expect(ActivityPub::Activity).not_to receive(:factory).with(
+          expect(ActivityPub::Activity).to_not receive(:factory).with(
             hash_including(
               'object' => hash_including(
                 'id' => 'https://example.com/users/bob/fake-status'
@@ -216,7 +218,7 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do
             anything
           )
 
-          expect(ActivityPub::Activity).not_to receive(:factory).with(
+          expect(ActivityPub::Activity).to_not receive(:factory).with(
             hash_including(
               'object' => hash_including(
                 'content' => '<p>puck was here</p>'
diff --git a/spec/services/activitypub/process_status_update_service_spec.rb b/spec/services/activitypub/process_status_update_service_spec.rb
index 5d15f6ffe..e9f23b9cf 100644
--- a/spec/services/activitypub/process_status_update_service_spec.rb
+++ b/spec/services/activitypub/process_status_update_service_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 def poll_option_json(name, votes)
@@ -5,21 +7,9 @@ def poll_option_json(name, votes)
 end
 
 RSpec.describe ActivityPub::ProcessStatusUpdateService, type: :service do
-  let!(:status) { Fabricate(:status, text: 'Hello world', account: Fabricate(:account, domain: 'example.com')) }
-
-  let(:alice) { Fabricate(:account) }
-  let(:bob) { Fabricate(:account) }
-
-  let(:mentions) { [] }
-  let(:tags) { [] }
-  let(:media_attachments) { [] }
-
-  before do
-    mentions.each { |a| Fabricate(:mention, status: status, account: a) }
-    tags.each { |t| status.tags << t }
-    media_attachments.each { |m| status.media_attachments << m }
-  end
+  subject { described_class.new }
 
+  let!(:status) { Fabricate(:status, text: 'Hello world', account: Fabricate(:account, domain: 'example.com')) }
   let(:payload) do
     {
       '@context': 'https://www.w3.org/ns/activitystreams',
@@ -34,10 +24,20 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService, type: :service do
       ],
     }
   end
-
   let(:json) { Oj.load(Oj.dump(payload)) }
 
-  subject { described_class.new }
+  let(:alice) { Fabricate(:account) }
+  let(:bob) { Fabricate(:account) }
+
+  let(:mentions) { [] }
+  let(:tags) { [] }
+  let(:media_attachments) { [] }
+
+  before do
+    mentions.each { |a| Fabricate(:mention, status: status, account: a) }
+    tags.each { |t| status.tags << t }
+    media_attachments.each { |m| status.media_attachments << m }
+  end
 
   describe '#call' do
     it 'updates text' do
@@ -214,11 +214,11 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService, type: :service do
       end
 
       it 'does not create any edits' do
-        expect { subject.call(status, json) }.not_to change { status.reload.edits.pluck(&:id) }
+        expect { subject.call(status, json) }.to_not change { status.reload.edits.pluck(&:id) }
       end
 
       it 'does not update the text, spoiler_text or edited_at' do
-        expect { subject.call(status, json) }.not_to change { s = status.reload; [s.text, s.spoiler_text, s.edited_at] }
+        expect { subject.call(status, json) }.to_not change { s = status.reload; [s.text, s.spoiler_text, s.edited_at] }
       end
     end
 
@@ -412,7 +412,7 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService, type: :service do
       end
 
       it 'removes poll' do
-        expect(status.reload.poll).to eq nil
+        expect(status.reload.poll).to be_nil
       end
 
       it 'records media change in edit' do
diff --git a/spec/services/activitypub/synchronize_followers_service_spec.rb b/spec/services/activitypub/synchronize_followers_service_spec.rb
index 5a37f0733..c9a513e24 100644
--- a/spec/services/activitypub/synchronize_followers_service_spec.rb
+++ b/spec/services/activitypub/synchronize_followers_service_spec.rb
@@ -1,6 +1,10 @@
+# frozen_string_literal: true
+
 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 +29,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..b75f92372 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,13 @@
+# frozen_string_literal: true
+
 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/after_block_service_spec.rb b/spec/services/after_block_service_spec.rb
index 337766d06..d81bba1d8 100644
--- a/spec/services/after_block_service_spec.rb
+++ b/spec/services/after_block_service_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe AfterBlockService, type: :service do
diff --git a/spec/services/app_sign_up_service_spec.rb b/spec/services/app_sign_up_service_spec.rb
index 8ec4d4a7a..253230496 100644
--- a/spec/services/app_sign_up_service_spec.rb
+++ b/spec/services/app_sign_up_service_spec.rb
@@ -1,12 +1,14 @@
+# frozen_string_literal: true
+
 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..63d9e2a0f 100644
--- a/spec/services/authorize_follow_service_spec.rb
+++ b/spec/services/authorize_follow_service_spec.rb
@@ -1,10 +1,12 @@
+# frozen_string_literal: true
+
 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/batched_remove_status_service_spec.rb b/spec/services/batched_remove_status_service_spec.rb
index 920edeb13..9bedf3744 100644
--- a/spec/services/batched_remove_status_service_spec.rb
+++ b/spec/services/batched_remove_status_service_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe BatchedRemoveStatusService, type: :service do
diff --git a/spec/services/block_domain_service_spec.rb b/spec/services/block_domain_service_spec.rb
index 242b02fff..0ab97b8ce 100644
--- a/spec/services/block_domain_service_spec.rb
+++ b/spec/services/block_domain_service_spec.rb
@@ -1,14 +1,16 @@
+# frozen_string_literal: true
+
 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))
@@ -67,9 +69,9 @@ RSpec.describe BlockDomainService, type: :service do
     end
 
     it 'leaves the domains status and attachments, but clears media' do
-      expect { bad_status1.reload }.not_to raise_error
-      expect { bad_status2.reload }.not_to raise_error
-      expect { bad_attachment.reload }.not_to raise_error
+      expect { bad_status1.reload }.to_not raise_error
+      expect { bad_status2.reload }.to_not raise_error
+      expect { bad_attachment.reload }.to_not raise_error
       expect(bad_attachment.file.exists?).to be false
     end
   end
diff --git a/spec/services/block_service_spec.rb b/spec/services/block_service_spec.rb
index a53e1f928..75f07f5ad 100644
--- a/spec/services/block_service_spec.rb
+++ b/spec/services/block_service_spec.rb
@@ -1,10 +1,12 @@
+# frozen_string_literal: true
+
 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/bootstrap_timeline_service_spec.rb b/spec/services/bootstrap_timeline_service_spec.rb
index 149f6e6df..670ac652f 100644
--- a/spec/services/bootstrap_timeline_service_spec.rb
+++ b/spec/services/bootstrap_timeline_service_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe BootstrapTimelineService, type: :service do
diff --git a/spec/services/clear_domain_media_service_spec.rb b/spec/services/clear_domain_media_service_spec.rb
index 45b92e2c9..987507579 100644
--- a/spec/services/clear_domain_media_service_spec.rb
+++ b/spec/services/clear_domain_media_service_spec.rb
@@ -1,22 +1,24 @@
+# frozen_string_literal: true
+
 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))
     end
 
     it 'leaves the domains status and attachments, but clears media' do
-      expect { bad_status1.reload }.not_to raise_error
-      expect { bad_status2.reload }.not_to raise_error
-      expect { bad_attachment.reload }.not_to raise_error
+      expect { bad_status1.reload }.to_not raise_error
+      expect { bad_status2.reload }.to_not raise_error
+      expect { bad_attachment.reload }.to_not raise_error
       expect(bad_attachment.file.exists?).to be false
     end
   end
diff --git a/spec/services/delete_account_service_spec.rb b/spec/services/delete_account_service_spec.rb
index cc4b168fc..61e5c3c9b 100644
--- a/spec/services/delete_account_service_spec.rb
+++ b/spec/services/delete_account_service_spec.rb
@@ -1,7 +1,11 @@
+# frozen_string_literal: true
+
 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 +27,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 {
         [
@@ -50,9 +52,9 @@ RSpec.describe DeleteAccountService, type: :service do
 
     it 'deletes associated target notifications' do
       expect { subject }.to change {
-        [
-          'poll', 'favourite', 'status', 'mention', 'follow'
-        ].map { |type| Notification.where(type: type).count }
+        %w(
+          poll favourite status mention follow
+        ).map { |type| Notification.where(type: type).count }
       }.from([1, 1, 1, 1, 1]).to([0, 0, 0, 0, 0])
     end
   end
diff --git a/spec/services/fan_out_on_write_service_spec.rb b/spec/services/fan_out_on_write_service_spec.rb
index 59e15d230..3b554f9ea 100644
--- a/spec/services/fan_out_on_write_service_spec.rb
+++ b/spec/services/fan_out_on_write_service_spec.rb
@@ -1,16 +1,17 @@
+# frozen_string_literal: true
+
 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') }
 
   let!(:alice) { Fabricate(:user, current_sign_in_at: last_active_at).account }
   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 }
-
-  let(:status) { Fabricate(:status, account: alice, visibility: visibility, text: 'Hello @bob #hoge') }
-
   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..613ae203e 100644
--- a/spec/services/favourite_service_spec.rb
+++ b/spec/services/favourite_service_spec.rb
@@ -1,10 +1,12 @@
+# frozen_string_literal: true
+
 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_link_card_service_spec.rb b/spec/services/fetch_link_card_service_spec.rb
index 458473c39..d79ab7a43 100644
--- a/spec/services/fetch_link_card_service_spec.rb
+++ b/spec/services/fetch_link_card_service_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe FetchLinkCardService, type: :service do
diff --git a/spec/services/fetch_oembed_service_spec.rb b/spec/services/fetch_oembed_service_spec.rb
index cf46f2d39..8a0b49222 100644
--- a/spec/services/fetch_oembed_service_spec.rb
+++ b/spec/services/fetch_oembed_service_spec.rb
@@ -62,7 +62,7 @@ describe FetchOEmbedService, type: :service do
 
         it 'does not cache OEmbed endpoint' do
           subject.call('https://host.test/oembed.html', format: :xml)
-          expect(Rails.cache.exist?('oembed_endpoint:host.test')).to eq false
+          expect(Rails.cache.exist?('oembed_endpoint:host.test')).to be false
         end
       end
 
@@ -83,7 +83,7 @@ describe FetchOEmbedService, type: :service do
 
         it 'does not cache OEmbed endpoint' do
           subject.call('https://host.test/oembed.html')
-          expect(Rails.cache.exist?('oembed_endpoint:host.test')).to eq false
+          expect(Rails.cache.exist?('oembed_endpoint:host.test')).to be false
         end
       end
 
@@ -104,7 +104,7 @@ describe FetchOEmbedService, type: :service do
 
         it 'does not cache OEmbed endpoint' do
           subject.call('https://host.test/oembed.html')
-          expect(Rails.cache.exist?('oembed_endpoint:host.test')).to eq false
+          expect(Rails.cache.exist?('oembed_endpoint:host.test')).to be false
         end
       end
 
diff --git a/spec/services/fetch_remote_status_service_spec.rb b/spec/services/fetch_remote_status_service_spec.rb
index 02c62f8d6..694a75dc2 100644
--- a/spec/services/fetch_remote_status_service_spec.rb
+++ b/spec/services/fetch_remote_status_service_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe FetchRemoteStatusService, type: :service do
@@ -16,6 +18,7 @@ RSpec.describe FetchRemoteStatusService, type: :service do
 
   context 'protocol is :activitypub' do
     subject { described_class.new.call(note[:id], prefetched_body: prefetched_body) }
+
     let(:prefetched_body) { Oj.dump(note) }
 
     before do
diff --git a/spec/services/fetch_resource_service_spec.rb b/spec/services/fetch_resource_service_spec.rb
index c39f52632..da7e42351 100644
--- a/spec/services/fetch_resource_service_spec.rb
+++ b/spec/services/fetch_resource_service_spec.rb
@@ -1,11 +1,13 @@
+# frozen_string_literal: true
+
 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) { '' }
 
@@ -74,7 +76,7 @@ RSpec.describe FetchResourceService, type: :service do
       context 'when content type is application/atom+xml' do
         let(:content_type) { 'application/atom+xml' }
 
-        it { is_expected.to eq nil }
+        it { is_expected.to be_nil }
       end
 
       context 'when content type is activity+json' do
diff --git a/spec/services/follow_service_spec.rb b/spec/services/follow_service_spec.rb
index 59073c27f..67a8b2c54 100644
--- a/spec/services/follow_service_spec.rb
+++ b/spec/services/follow_service_spec.rb
@@ -1,10 +1,12 @@
+# frozen_string_literal: true
+
 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/import_service_spec.rb b/spec/services/import_service_spec.rb
index a12148833..f081f2d9d 100644
--- a/spec/services/import_service_spec.rb
+++ b/spec/services/import_service_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe ImportService, type: :service do
@@ -183,15 +185,14 @@ RSpec.describe ImportService, type: :service do
     subject { ImportService.new }
 
     let!(:nare) { Fabricate(:account, username: 'nare', domain: 'թութ.հայ', locked: false, protocol: :activitypub, inbox_url: 'https://թութ.հայ/inbox') }
+    let(:csv) { attachment_fixture('utf8-followers.txt') }
+    let(:import) { Import.create(account: account, type: 'following', data: csv) }
 
     # Make sure to not actually go to the remote server
     before do
       stub_request(:post, 'https://թութ.հայ/inbox').to_return(status: 200)
     end
 
-    let(:csv) { attachment_fixture('utf8-followers.txt') }
-    let(:import) { Import.create(account: account, type: 'following', data: csv) }
-
     it 'follows the listed account' do
       expect(account.follow_requests.count).to eq 0
       subject.call(import)
@@ -203,6 +204,9 @@ RSpec.describe ImportService, type: :service do
     subject { ImportService.new }
 
     let(:csv) { attachment_fixture('bookmark-imports.txt') }
+    let(:local_account)  { Fabricate(:account, username: 'foo', domain: '') }
+    let!(:remote_status) { Fabricate(:status, uri: 'https://example.com/statuses/1312') }
+    let!(:direct_status) { Fabricate(:status, uri: 'https://example.com/statuses/direct', visibility: :direct) }
 
     around(:each) do |example|
       local_before = Rails.configuration.x.local_domain
@@ -214,10 +218,6 @@ RSpec.describe ImportService, type: :service do
       Rails.configuration.x.local_domain = local_before
     end
 
-    let(:local_account)  { Fabricate(:account, username: 'foo', domain: '') }
-    let!(:remote_status) { Fabricate(:status, uri: 'https://example.com/statuses/1312') }
-    let!(:direct_status) { Fabricate(:status, uri: 'https://example.com/statuses/direct', visibility: :direct) }
-
     before do
       service = double
       allow(ActivityPub::FetchRemoteStatusService).to receive(:new).and_return(service)
@@ -234,7 +234,7 @@ RSpec.describe ImportService, type: :service do
         subject.call(import)
         expect(account.bookmarks.map(&:status).map(&:id)).to include(local_status.id)
         expect(account.bookmarks.map(&:status).map(&:id)).to include(remote_status.id)
-        expect(account.bookmarks.map(&:status).map(&:id)).not_to include(direct_status.id)
+        expect(account.bookmarks.map(&:status).map(&:id)).to_not include(direct_status.id)
         expect(account.bookmarks.count).to eq 3
       end
     end
diff --git a/spec/services/mute_service_spec.rb b/spec/services/mute_service_spec.rb
index 57d8c41de..50f74ff27 100644
--- a/spec/services/mute_service_spec.rb
+++ b/spec/services/mute_service_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe MuteService, type: :service do
diff --git a/spec/services/notify_service_spec.rb b/spec/services/notify_service_spec.rb
index 67dd0483b..da2857627 100644
--- a/spec/services/notify_service_spec.rb
+++ b/spec/services/notify_service_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe NotifyService, type: :service do
diff --git a/spec/services/post_status_service_spec.rb b/spec/services/post_status_service_spec.rb
index 0b72253a5..33153c3d0 100644
--- a/spec/services/post_status_service_spec.rb
+++ b/spec/services/post_status_service_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe PostStatusService, type: :service do
@@ -50,7 +52,7 @@ RSpec.describe PostStatusService, type: :service do
     end
 
     it 'does not change statuses count' do
-      expect { subject.call(account, text: 'Hi future!', scheduled_at: future, thread: previous_status) }.not_to change { [account.statuses_count, previous_status.replies_count] }
+      expect { subject.call(account, text: 'Hi future!', scheduled_at: future, thread: previous_status) }.to_not change { [account.statuses_count, previous_status.replies_count] }
     end
   end
 
@@ -157,7 +159,7 @@ RSpec.describe PostStatusService, type: :service do
 
     expect do
       subject.call(account, text: '@alice @alice @alice hey @alice')
-    end.not_to raise_error
+    end.to_not raise_error
   end
 
   it 'processes hashtags' do
@@ -216,7 +218,7 @@ RSpec.describe PostStatusService, type: :service do
       media_ids: [media.id]
     )
 
-    expect(media.reload.status).to eq nil
+    expect(media.reload.status).to be_nil
   end
 
   it 'does not allow attaching more than 4 files' do
diff --git a/spec/services/precompute_feed_service_spec.rb b/spec/services/precompute_feed_service_spec.rb
index b28824f9a..86ab59b29 100644
--- a/spec/services/precompute_feed_service_spec.rb
+++ b/spec/services/precompute_feed_service_spec.rb
@@ -31,7 +31,7 @@ RSpec.describe PrecomputeFeedService, type: :service do
 
       subject.call(account)
 
-      expect(redis.zscore(FeedManager.instance.key(:home, account.id), reblog.id)).to eq nil
+      expect(redis.zscore(FeedManager.instance.key(:home, account.id), reblog.id)).to be_nil
     end
   end
 end
diff --git a/spec/services/process_mentions_service_spec.rb b/spec/services/process_mentions_service_spec.rb
index 6a16928e0..adc45c60a 100644
--- a/spec/services/process_mentions_service_spec.rb
+++ b/spec/services/process_mentions_service_spec.rb
@@ -1,10 +1,12 @@
+# frozen_string_literal: true
+
 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..310affa5e 100644
--- a/spec/services/purge_domain_service_spec.rb
+++ b/spec/services/purge_domain_service_spec.rb
@@ -1,13 +1,15 @@
+# frozen_string_literal: true
+
 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..c00472229 100644
--- a/spec/services/reblog_service_spec.rb
+++ b/spec/services/reblog_service_spec.rb
@@ -1,15 +1,17 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 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 +47,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..be9363d84 100644
--- a/spec/services/reject_follow_service_spec.rb
+++ b/spec/services/reject_follow_service_spec.rb
@@ -1,10 +1,12 @@
+# frozen_string_literal: true
+
 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_followers_service_spec.rb
index 9b9c846cf..21cea2e4f 100644
--- a/spec/services/remove_from_follwers_service_spec.rb
+++ b/spec/services/remove_from_followers_service_spec.rb
@@ -1,10 +1,12 @@
+# frozen_string_literal: true
+
 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/remove_status_service_spec.rb b/spec/services/remove_status_service_spec.rb
index e253052f3..a836109a0 100644
--- a/spec/services/remove_status_service_spec.rb
+++ b/spec/services/remove_status_service_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe RemoveStatusService, type: :service do
diff --git a/spec/services/report_service_spec.rb b/spec/services/report_service_spec.rb
index 02bc42ac1..9d81bd971 100644
--- a/spec/services/report_service_spec.rb
+++ b/spec/services/report_service_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe ReportService, type: :service do
@@ -29,13 +31,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 +87,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/resolve_account_service_spec.rb b/spec/services/resolve_account_service_spec.rb
index 192225229..3ce1f7f2b 100644
--- a/spec/services/resolve_account_service_spec.rb
+++ b/spec/services/resolve_account_service_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe ResolveAccountService, type: :service do
@@ -108,7 +110,7 @@ RSpec.describe ResolveAccountService, type: :service do
     it 'returns new remote account' do
       account = subject.call('Foo@redirected.example.com')
 
-      expect(account.activitypub?).to eq true
+      expect(account.activitypub?).to be true
       expect(account.acct).to eq 'foo@ap.example.com'
       expect(account.inbox_url).to eq 'https://ap.example.com/users/foo/inbox'
     end
@@ -123,7 +125,7 @@ RSpec.describe ResolveAccountService, type: :service do
     it 'returns new remote account' do
       account = subject.call('Foo@redirected.example.com')
 
-      expect(account.activitypub?).to eq true
+      expect(account.activitypub?).to be true
       expect(account.acct).to eq 'foo@ap.example.com'
       expect(account.inbox_url).to eq 'https://ap.example.com/users/foo/inbox'
     end
@@ -146,7 +148,7 @@ RSpec.describe ResolveAccountService, type: :service do
     it 'returns new remote account' do
       account = subject.call('foo@ap.example.com')
 
-      expect(account.activitypub?).to eq true
+      expect(account.activitypub?).to be true
       expect(account.domain).to eq 'ap.example.com'
       expect(account.inbox_url).to eq 'https://ap.example.com/users/foo/inbox'
     end
@@ -159,7 +161,7 @@ RSpec.describe ResolveAccountService, type: :service do
       it 'returns new remote account' do
         account = subject.call('foo@ap.example.com')
 
-        expect(account.activitypub?).to eq true
+        expect(account.activitypub?).to be true
         expect(account.domain).to eq 'ap.example.com'
         expect(account.inbox_url).to eq 'https://ap.example.com/users/foo/inbox'
         expect(account.actor_type).to eq 'Person'
@@ -174,7 +176,7 @@ RSpec.describe ResolveAccountService, type: :service do
     it 'returns new remote account' do
       account = subject.call('foo@ap.example.com')
 
-      expect(account.activitypub?).to eq true
+      expect(account.activitypub?).to be true
       expect(account.domain).to eq 'ap.example.com'
       expect(account.inbox_url).to eq 'https://ap.example.com/users/foo/inbox'
       expect(account.uri).to eq 'https://ap.example.com/users/foo'
@@ -195,7 +197,7 @@ RSpec.describe ResolveAccountService, type: :service do
     it 'returns new remote account' do
       account = subject.call('foo@ap.example.com')
 
-      expect(account.activitypub?).to eq true
+      expect(account.activitypub?).to be true
       expect(account.domain).to eq 'ap.example.com'
       expect(account.inbox_url).to eq 'https://ap.example.com/users/foo/inbox'
       expect(account.uri).to eq 'https://ap.example.com/users/foo'
diff --git a/spec/services/search_service_spec.rb b/spec/services/search_service_spec.rb
index 6f32007e8..7ec334a56 100644
--- a/spec/services/search_service_spec.rb
+++ b/spec/services/search_service_spec.rb
@@ -13,8 +13,8 @@ describe SearchService, type: :service do
         results = subject.call('', nil, 10)
 
         expect(results).to eq(empty_results)
-        expect(AccountSearchService).not_to have_received(:new)
-        expect(Tag).not_to have_received(:search_for)
+        expect(AccountSearchService).to_not have_received(:new)
+        expect(Tag).to_not have_received(:search_for)
       end
     end
 
@@ -89,7 +89,7 @@ describe SearchService, type: :service do
           allow(Tag).to receive(:search_for)
 
           results = subject.call(query, nil, 10)
-          expect(Tag).not_to have_received(:search_for)
+          expect(Tag).to_not have_received(:search_for)
           expect(results).to eq empty_results
         end
 
diff --git a/spec/services/suspend_account_service_spec.rb b/spec/services/suspend_account_service_spec.rb
index 126b13986..4489bfed5 100644
--- a/spec/services/suspend_account_service_spec.rb
+++ b/spec/services/suspend_account_service_spec.rb
@@ -1,12 +1,14 @@
+# frozen_string_literal: true
+
 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..48e310a9d 100644
--- a/spec/services/unallow_domain_service_spec.rb
+++ b/spec/services/unallow_domain_service_spec.rb
@@ -1,6 +1,10 @@
+# frozen_string_literal: true
+
 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 +12,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..8098d7e6d 100644
--- a/spec/services/unblock_service_spec.rb
+++ b/spec/services/unblock_service_spec.rb
@@ -1,10 +1,12 @@
+# frozen_string_literal: true
+
 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..a12f01fa5 100644
--- a/spec/services/unfollow_service_spec.rb
+++ b/spec/services/unfollow_service_spec.rb
@@ -1,10 +1,12 @@
+# frozen_string_literal: true
+
 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/unmute_service_spec.rb b/spec/services/unmute_service_spec.rb
index 8463eb283..2edb6cfc2 100644
--- a/spec/services/unmute_service_spec.rb
+++ b/spec/services/unmute_service_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe UnmuteService, type: :service do
diff --git a/spec/services/unsuspend_account_service_spec.rb b/spec/services/unsuspend_account_service_spec.rb
index 987eb09e2..5d7012093 100644
--- a/spec/services/unsuspend_account_service_spec.rb
+++ b/spec/services/unsuspend_account_service_spec.rb
@@ -1,12 +1,14 @@
+# frozen_string_literal: true
+
 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)
diff --git a/spec/services/update_account_service_spec.rb b/spec/services/update_account_service_spec.rb
index c2dc791e4..a711a8ae7 100644
--- a/spec/services/update_account_service_spec.rb
+++ b/spec/services/update_account_service_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe UpdateAccountService, type: :service do
diff --git a/spec/services/update_status_service_spec.rb b/spec/services/update_status_service_spec.rb
index a7364ca8b..e52a0e52b 100644
--- a/spec/services/update_status_service_spec.rb
+++ b/spec/services/update_status_service_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe UpdateStatusService, type: :service do
diff --git a/spec/services/verify_link_service_spec.rb b/spec/services/verify_link_service_spec.rb
index 8f65f3a84..ea9ccc3fc 100644
--- a/spec/services/verify_link_service_spec.rb
+++ b/spec/services/verify_link_service_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe VerifyLinkService, type: :service do