about summary refs log tree commit diff
path: root/spec/lib
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/activitypub/activity/accept_spec.rb6
-rw-r--r--spec/lib/activitypub/activity/add_spec.rb14
-rw-r--r--spec/lib/activitypub/activity/announce_spec.rb12
-rw-r--r--spec/lib/activitypub/activity/block_spec.rb2
-rw-r--r--spec/lib/activitypub/activity/create_spec.rb44
-rw-r--r--spec/lib/activitypub/activity/delete_spec.rb4
-rw-r--r--spec/lib/activitypub/activity/flag_spec.rb3
-rw-r--r--spec/lib/activitypub/activity/follow_spec.rb2
-rw-r--r--spec/lib/activitypub/activity/like_spec.rb2
-rw-r--r--spec/lib/activitypub/activity/move_spec.rb2
-rw-r--r--spec/lib/activitypub/activity/reject_spec.rb6
-rw-r--r--spec/lib/activitypub/activity/remove_spec.rb2
-rw-r--r--spec/lib/activitypub/activity/undo_spec.rb6
-rw-r--r--spec/lib/activitypub/activity/update_spec.rb6
-rw-r--r--spec/lib/activitypub/adapter_spec.rb6
-rw-r--r--spec/lib/activitypub/dereferencer_spec.rb6
-rw-r--r--spec/lib/activitypub/linked_data_signature_spec.rb6
-rw-r--r--spec/lib/activitypub/tag_manager_spec.rb2
-rw-r--r--spec/lib/emoji_formatter_spec.rb10
-rw-r--r--spec/lib/entity_cache_spec.rb4
-rw-r--r--spec/lib/feed_manager_spec.rb30
-rw-r--r--spec/lib/html_aware_formatter_spec.rb10
-rw-r--r--spec/lib/link_details_extractor_spec.rb6
-rw-r--r--spec/lib/ostatus/tag_manager_spec.rb12
-rw-r--r--spec/lib/plain_text_formatter_spec.rb6
-rw-r--r--spec/lib/request_pool_spec.rb2
-rw-r--r--spec/lib/request_spec.rb8
-rw-r--r--spec/lib/status_filter_spec.rb8
-rw-r--r--spec/lib/status_reach_finder_spec.rb4
-rw-r--r--spec/lib/suspicious_sign_in_detector_spec.rb6
-rw-r--r--spec/lib/tag_manager_spec.rb22
-rw-r--r--spec/lib/text_formatter_spec.rb84
-rw-r--r--spec/lib/user_settings_decorator_spec.rb20
-rw-r--r--spec/lib/vacuum/access_tokens_vacuum_spec.rb2
-rw-r--r--spec/lib/vacuum/backups_vacuum_spec.rb6
-rw-r--r--spec/lib/vacuum/feeds_vacuum_spec.rb2
-rw-r--r--spec/lib/vacuum/media_attachments_vacuum_spec.rb5
-rw-r--r--spec/lib/vacuum/preview_cards_vacuum_spec.rb6
-rw-r--r--spec/lib/vacuum/statuses_vacuum_spec.rb6
-rw-r--r--spec/lib/vacuum/system_keys_vacuum_spec.rb2
-rw-r--r--spec/lib/webfinger_resource_spec.rb2
41 files changed, 231 insertions, 163 deletions
diff --git a/spec/lib/activitypub/activity/accept_spec.rb b/spec/lib/activitypub/activity/accept_spec.rb
index 304cf2208..890a07be5 100644
--- a/spec/lib/activitypub/activity/accept_spec.rb
+++ b/spec/lib/activitypub/activity/accept_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe ActivityPub::Activity::Accept do
@@ -42,6 +44,8 @@ RSpec.describe ActivityPub::Activity::Accept do
   end
 
   context 'given a relay' do
+    subject { described_class.new(json, sender) }
+
     let!(:relay) { Fabricate(:relay, state: :pending, follow_activity_id: 'https://abc-123/456') }
 
     let(:json) do
@@ -59,8 +63,6 @@ RSpec.describe ActivityPub::Activity::Accept do
       }.with_indifferent_access
     end
 
-    subject { described_class.new(json, sender) }
-
     it 'marks the relay as accepted' do
       subject.perform
       expect(relay.reload.accepted?).to be true
diff --git a/spec/lib/activitypub/activity/add_spec.rb b/spec/lib/activitypub/activity/add_spec.rb
index 0b08e2924..9c45e465e 100644
--- a/spec/lib/activitypub/activity/add_spec.rb
+++ b/spec/lib/activitypub/activity/add_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe ActivityPub::Activity::Add do
@@ -48,10 +50,10 @@ RSpec.describe ActivityPub::Activity::Add do
         end
 
         it 'fetches the status and pins it' do
-          allow(service_stub).to receive(:call) do |uri, id: true, on_behalf_of: nil, request_id: nil|
+          allow(service_stub).to receive(:call) do |uri, id: true, on_behalf_of: nil, request_id: nil| # rubocop:disable Lint/UnusedBlockArgument
             expect(uri).to eq 'https://example.com/unknown'
-            expect(id).to eq true
-            expect(on_behalf_of&.following?(sender)).to eq true
+            expect(id).to be true
+            expect(on_behalf_of&.following?(sender)).to be true
             status
           end
           subject.perform
@@ -62,10 +64,10 @@ RSpec.describe ActivityPub::Activity::Add do
 
       context 'when there is no local follower' do
         it 'tries to fetch the status' do
-          allow(service_stub).to receive(:call) do |uri, id: true, on_behalf_of: nil, request_id: nil|
+          allow(service_stub).to receive(:call) do |uri, id: true, on_behalf_of: nil, request_id: nil| # rubocop:disable Lint/UnusedBlockArgument
             expect(uri).to eq 'https://example.com/unknown'
-            expect(id).to eq true
-            expect(on_behalf_of).to eq nil
+            expect(id).to be true
+            expect(on_behalf_of).to be_nil
             nil
           end
           subject.perform
diff --git a/spec/lib/activitypub/activity/announce_spec.rb b/spec/lib/activitypub/activity/announce_spec.rb
index 461c3757b..394b1d7b9 100644
--- a/spec/lib/activitypub/activity/announce_spec.rb
+++ b/spec/lib/activitypub/activity/announce_spec.rb
@@ -1,6 +1,10 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe ActivityPub::Activity::Announce do
+  subject { described_class.new(json, sender) }
+
   let(:sender)    { Fabricate(:account, followers_url: 'http://example.com/followers', uri: 'https://example.com/actor') }
   let(:recipient) { Fabricate(:account) }
   let(:status)    { Fabricate(:status, account: recipient) }
@@ -27,8 +31,6 @@ RSpec.describe ActivityPub::Activity::Announce do
     }
   end
 
-  subject { described_class.new(json, sender) }
-
   describe '#perform' do
     context 'when sender is followed by a local account' do
       before do
@@ -110,13 +112,13 @@ RSpec.describe ActivityPub::Activity::Announce do
     end
 
     context 'when the sender is relayed' do
+      subject { described_class.new(json, sender, relayed_through_actor: relay_account) }
+
       let!(:relay_account) { Fabricate(:account, inbox_url: 'https://relay.example.com/inbox') }
       let!(:relay) { Fabricate(:relay, inbox_url: 'https://relay.example.com/inbox') }
 
       let(:object_json) { 'https://example.com/actor/hello-world' }
 
-      subject { described_class.new(json, sender, relayed_through_actor: relay_account) }
-
       before do
         stub_request(:get, 'https://example.com/actor/hello-world').to_return(body: Oj.dump(unknown_object_json))
       end
@@ -139,7 +141,7 @@ RSpec.describe ActivityPub::Activity::Announce do
         end
 
         it 'does not fetch the remote status' do
-          expect(a_request(:get, 'https://example.com/actor/hello-world')).not_to have_been_made
+          expect(a_request(:get, 'https://example.com/actor/hello-world')).to_not have_been_made
           expect(Status.find_by(uri: 'https://example.com/actor/hello-world')).to be_nil
         end
 
diff --git a/spec/lib/activitypub/activity/block_spec.rb b/spec/lib/activitypub/activity/block_spec.rb
index 42bdfdc81..6f6898401 100644
--- a/spec/lib/activitypub/activity/block_spec.rb
+++ b/spec/lib/activitypub/activity/block_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe ActivityPub::Activity::Block do
diff --git a/spec/lib/activitypub/activity/create_spec.rb b/spec/lib/activitypub/activity/create_spec.rb
index 0bf51fb9f..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
 
@@ -798,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,
@@ -824,6 +824,7 @@ RSpec.describe ActivityPub::Activity::Create do
           },
         }
       end
+      let(:target_device) { Fabricate(:device, account: recipient) }
 
       before do
         subject.perform
@@ -878,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,
@@ -895,6 +891,10 @@ RSpec.describe ActivityPub::Activity::Create do
         }
       end
 
+      before do
+        subject.perform
+      end
+
       it 'creates status' do
         status = sender.statuses.first
 
@@ -904,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,
@@ -921,6 +916,10 @@ RSpec.describe ActivityPub::Activity::Create do
         }
       end
 
+      before do
+        subject.perform
+      end
+
       it 'creates status' do
         status = sender.statuses.first
 
@@ -930,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,
@@ -947,6 +941,10 @@ RSpec.describe ActivityPub::Activity::Create do
         }
       end
 
+      before do
+        subject.perform
+      end
+
       it 'creates status' do
         status = sender.statuses.first
 
diff --git a/spec/lib/activitypub/activity/delete_spec.rb b/spec/lib/activitypub/activity/delete_spec.rb
index 9dfb8a61b..3a73b3726 100644
--- a/spec/lib/activitypub/activity/delete_spec.rb
+++ b/spec/lib/activitypub/activity/delete_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe ActivityPub::Activity::Delete do
@@ -30,6 +32,7 @@ RSpec.describe ActivityPub::Activity::Delete do
   context 'when the status has been reblogged' do
     describe '#perform' do
       subject { described_class.new(json, sender) }
+
       let!(:reblogger) { Fabricate(:account) }
       let!(:follower)  { Fabricate(:account, username: 'follower', protocol: :activitypub, domain: 'example.com', inbox_url: 'http://example.com/inbox') }
       let!(:reblog)    { Fabricate(:status, account: reblogger, reblog: status) }
@@ -53,6 +56,7 @@ RSpec.describe ActivityPub::Activity::Delete do
   context 'when the status has been reported' do
     describe '#perform' do
       subject { described_class.new(json, sender) }
+
       let!(:reporter) { Fabricate(:account) }
 
       before do
diff --git a/spec/lib/activitypub/activity/flag_spec.rb b/spec/lib/activitypub/activity/flag_spec.rb
index 7890fd1e8..005e185e6 100644
--- a/spec/lib/activitypub/activity/flag_spec.rb
+++ b/spec/lib/activitypub/activity/flag_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe ActivityPub::Activity::Flag do
@@ -110,6 +112,7 @@ RSpec.describe ActivityPub::Activity::Flag do
 
   describe '#perform with a defined uri' do
     subject { described_class.new(json, sender) }
+
     let(:flag_id) { 'http://example.com/reports/1' }
 
     before do
diff --git a/spec/lib/activitypub/activity/follow_spec.rb b/spec/lib/activitypub/activity/follow_spec.rb
index fd4ede82b..eb8b17d61 100644
--- a/spec/lib/activitypub/activity/follow_spec.rb
+++ b/spec/lib/activitypub/activity/follow_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe ActivityPub::Activity::Follow do
diff --git a/spec/lib/activitypub/activity/like_spec.rb b/spec/lib/activitypub/activity/like_spec.rb
index b69615a9d..640d61ab3 100644
--- a/spec/lib/activitypub/activity/like_spec.rb
+++ b/spec/lib/activitypub/activity/like_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe ActivityPub::Activity::Like do
diff --git a/spec/lib/activitypub/activity/move_spec.rb b/spec/lib/activitypub/activity/move_spec.rb
index c468fdeff..8bd23aa7b 100644
--- a/spec/lib/activitypub/activity/move_spec.rb
+++ b/spec/lib/activitypub/activity/move_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe ActivityPub::Activity::Move do
diff --git a/spec/lib/activitypub/activity/reject_spec.rb b/spec/lib/activitypub/activity/reject_spec.rb
index fed4cd8cd..5e0f09bfe 100644
--- a/spec/lib/activitypub/activity/reject_spec.rb
+++ b/spec/lib/activitypub/activity/reject_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe ActivityPub::Activity::Reject do
@@ -121,6 +123,8 @@ RSpec.describe ActivityPub::Activity::Reject do
   end
 
   context 'given a relay' do
+    subject { described_class.new(json, sender) }
+
     let!(:relay) { Fabricate(:relay, state: :pending, follow_activity_id: 'https://abc-123/456') }
 
     let(:json) do
@@ -138,8 +142,6 @@ RSpec.describe ActivityPub::Activity::Reject do
       }.with_indifferent_access
     end
 
-    subject { described_class.new(json, sender) }
-
     it 'marks the relay as rejected' do
       subject.perform
       expect(relay.reload.rejected?).to be true
diff --git a/spec/lib/activitypub/activity/remove_spec.rb b/spec/lib/activitypub/activity/remove_spec.rb
index 4209dfde2..fc12aec8c 100644
--- a/spec/lib/activitypub/activity/remove_spec.rb
+++ b/spec/lib/activitypub/activity/remove_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe ActivityPub::Activity::Remove do
diff --git a/spec/lib/activitypub/activity/undo_spec.rb b/spec/lib/activitypub/activity/undo_spec.rb
index c0309e49d..b4cbc7196 100644
--- a/spec/lib/activitypub/activity/undo_spec.rb
+++ b/spec/lib/activitypub/activity/undo_spec.rb
@@ -1,6 +1,10 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe ActivityPub::Activity::Undo do
+  subject { described_class.new(json, sender) }
+
   let(:sender) { Fabricate(:account, domain: 'example.com') }
 
   let(:json) do
@@ -13,8 +17,6 @@ RSpec.describe ActivityPub::Activity::Undo do
     }.with_indifferent_access
   end
 
-  subject { described_class.new(json, sender) }
-
   describe '#perform' do
     context 'with Announce' do
       let(:status) { Fabricate(:status) }
diff --git a/spec/lib/activitypub/activity/update_spec.rb b/spec/lib/activitypub/activity/update_spec.rb
index 4cd853af2..f77279c02 100644
--- a/spec/lib/activitypub/activity/update_spec.rb
+++ b/spec/lib/activitypub/activity/update_spec.rb
@@ -1,14 +1,16 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe ActivityPub::Activity::Update do
+  subject { described_class.new(json, sender) }
+
   let!(:sender) { Fabricate(:account) }
 
   before do
     sender.update!(uri: ActivityPub::TagManager.instance.uri_for(sender))
   end
 
-  subject { described_class.new(json, sender) }
-
   describe '#perform' do
     context 'with an Actor object' do
       let(:modified_sender) do
diff --git a/spec/lib/activitypub/adapter_spec.rb b/spec/lib/activitypub/adapter_spec.rb
index ea03797aa..b981ea9c6 100644
--- a/spec/lib/activitypub/adapter_spec.rb
+++ b/spec/lib/activitypub/adapter_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe ActivityPub::Adapter do
@@ -41,10 +43,10 @@ RSpec.describe ActivityPub::Adapter do
   end
 
   describe '#serializable_hash' do
-    let(:serializer_class) {}
-
     subject { ActiveModelSerializers::SerializableResource.new(TestObject.new(foo: 'bar'), serializer: serializer_class, adapter: described_class).as_json }
 
+    let(:serializer_class) {}
+
     context 'when serializer defines no context' do
       let(:serializer_class) { TestWithBasicContextSerializer }
 
diff --git a/spec/lib/activitypub/dereferencer_spec.rb b/spec/lib/activitypub/dereferencer_spec.rb
index e50b497c7..11078de86 100644
--- a/spec/lib/activitypub/dereferencer_spec.rb
+++ b/spec/lib/activitypub/dereferencer_spec.rb
@@ -1,14 +1,16 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe ActivityPub::Dereferencer do
   describe '#object' do
+    subject { described_class.new(uri, permitted_origin: permitted_origin, signature_actor: signature_actor).object }
+
     let(:object) { { '@context': 'https://www.w3.org/ns/activitystreams', id: 'https://example.com/foo', type: 'Note', content: 'Hoge' } }
     let(:permitted_origin) { 'https://example.com' }
     let(:signature_actor) { nil }
     let(:uri) { nil }
 
-    subject { described_class.new(uri, permitted_origin: permitted_origin, signature_actor: signature_actor).object }
-
     before do
       stub_request(:get, 'https://example.com/foo').to_return(body: Oj.dump(object), headers: { 'Content-Type' => 'application/activity+json' })
     end
diff --git a/spec/lib/activitypub/linked_data_signature_spec.rb b/spec/lib/activitypub/linked_data_signature_spec.rb
index d55a7c7fa..619d6df12 100644
--- a/spec/lib/activitypub/linked_data_signature_spec.rb
+++ b/spec/lib/activitypub/linked_data_signature_spec.rb
@@ -1,8 +1,12 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe ActivityPub::LinkedDataSignature do
   include JsonLdHelper
 
+  subject { described_class.new(json) }
+
   let!(:sender) { Fabricate(:account, uri: 'http://example.com/alice') }
 
   let(:raw_json) do
@@ -14,8 +18,6 @@ RSpec.describe ActivityPub::LinkedDataSignature do
 
   let(:json) { raw_json.merge('signature' => signature) }
 
-  subject { described_class.new(json) }
-
   before do
     stub_jsonld_contexts!
   end
diff --git a/spec/lib/activitypub/tag_manager_spec.rb b/spec/lib/activitypub/tag_manager_spec.rb
index 606a1de2e..596e91e95 100644
--- a/spec/lib/activitypub/tag_manager_spec.rb
+++ b/spec/lib/activitypub/tag_manager_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe ActivityPub::TagManager do
diff --git a/spec/lib/emoji_formatter_spec.rb b/spec/lib/emoji_formatter_spec.rb
index e1747bdd9..b73d5be4b 100644
--- a/spec/lib/emoji_formatter_spec.rb
+++ b/spec/lib/emoji_formatter_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe EmojiFormatter do
@@ -24,7 +26,7 @@ RSpec.describe EmojiFormatter do
       let(:text) { preformat_text(':coolcat: Beep boop') }
 
       it 'converts the shortcode to an image tag' do
-        is_expected.to match(/<img rel="emoji" draggable="false" width="16" height="16" class="emojione custom-emoji" alt=":coolcat:"/)
+        expect(subject).to match(/<img rel="emoji" draggable="false" width="16" height="16" class="emojione custom-emoji" alt=":coolcat:"/)
       end
     end
 
@@ -32,7 +34,7 @@ RSpec.describe EmojiFormatter do
       let(:text) { preformat_text('Beep :coolcat: boop') }
 
       it 'converts the shortcode to an image tag' do
-        is_expected.to match(/Beep <img rel="emoji" draggable="false" width="16" height="16" class="emojione custom-emoji" alt=":coolcat:"/)
+        expect(subject).to match(/Beep <img rel="emoji" draggable="false" width="16" height="16" class="emojione custom-emoji" alt=":coolcat:"/)
       end
     end
 
@@ -40,7 +42,7 @@ RSpec.describe EmojiFormatter do
       let(:text) { preformat_text(':coolcat::coolcat:') }
 
       it 'does not touch the shortcodes' do
-        is_expected.to match(/:coolcat::coolcat:/)
+        expect(subject).to match(/:coolcat::coolcat:/)
       end
     end
 
@@ -48,7 +50,7 @@ RSpec.describe EmojiFormatter do
       let(:text) { preformat_text('Beep boop :coolcat:') }
 
       it 'converts the shortcode to an image tag' do
-        is_expected.to match(/boop <img rel="emoji" draggable="false" width="16" height="16" class="emojione custom-emoji" alt=":coolcat:"/)
+        expect(subject).to match(/boop <img rel="emoji" draggable="false" width="16" height="16" class="emojione custom-emoji" alt=":coolcat:"/)
       end
     end
   end
diff --git a/spec/lib/entity_cache_spec.rb b/spec/lib/entity_cache_spec.rb
index 43494bd92..c750cddf3 100644
--- a/spec/lib/entity_cache_spec.rb
+++ b/spec/lib/entity_cache_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe EntityCache do
@@ -12,7 +14,7 @@ RSpec.describe EntityCache do
       let(:domain)     { 'example.org' }
 
       it 'returns an empty array' do
-        is_expected.to eq []
+        expect(subject).to eq []
       end
     end
   end
diff --git a/spec/lib/feed_manager_spec.rb b/spec/lib/feed_manager_spec.rb
index b25084938..d1e0d60e0 100644
--- a/spec/lib/feed_manager_spec.rb
+++ b/spec/lib/feed_manager_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe FeedManager do
@@ -304,7 +306,7 @@ RSpec.describe FeedManager do
       status = Fabricate(:status, reblog: reblog)
       FeedManager.instance.push_to_home(account, status)
 
-      expect(FeedManager.instance.push_to_home(account, reblog)).to eq false
+      expect(FeedManager.instance.push_to_home(account, reblog)).to be false
     end
   end
 
@@ -329,7 +331,7 @@ RSpec.describe FeedManager do
       status = Fabricate(:status, reblog: reblog)
       FeedManager.instance.push_to_list(list, status)
 
-      expect(FeedManager.instance.push_to_list(list, reblog)).to eq false
+      expect(FeedManager.instance.push_to_list(list, reblog)).to be false
     end
 
     context 'when replies policy is set to no replies' do
@@ -339,19 +341,19 @@ RSpec.describe FeedManager do
 
       it 'pushes statuses that are not replies' do
         status = Fabricate(:status, text: 'Hello world', account: bob)
-        expect(FeedManager.instance.push_to_list(list, status)).to eq true
+        expect(FeedManager.instance.push_to_list(list, status)).to be true
       end
 
       it 'pushes statuses that are replies to list owner' do
         status = Fabricate(:status, text: 'Hello world', account: owner)
         reply  = Fabricate(:status, text: 'Nay', thread: status, account: bob)
-        expect(FeedManager.instance.push_to_list(list, reply)).to eq true
+        expect(FeedManager.instance.push_to_list(list, reply)).to be true
       end
 
       it 'does not push replies to another member of the list' do
         status = Fabricate(:status, text: 'Hello world', account: alice)
         reply  = Fabricate(:status, text: 'Nay', thread: status, account: bob)
-        expect(FeedManager.instance.push_to_list(list, reply)).to eq false
+        expect(FeedManager.instance.push_to_list(list, reply)).to be false
       end
     end
 
@@ -362,25 +364,25 @@ RSpec.describe FeedManager do
 
       it 'pushes statuses that are not replies' do
         status = Fabricate(:status, text: 'Hello world', account: bob)
-        expect(FeedManager.instance.push_to_list(list, status)).to eq true
+        expect(FeedManager.instance.push_to_list(list, status)).to be true
       end
 
       it 'pushes statuses that are replies to list owner' do
         status = Fabricate(:status, text: 'Hello world', account: owner)
         reply  = Fabricate(:status, text: 'Nay', thread: status, account: bob)
-        expect(FeedManager.instance.push_to_list(list, reply)).to eq true
+        expect(FeedManager.instance.push_to_list(list, reply)).to be true
       end
 
       it 'pushes replies to another member of the list' do
         status = Fabricate(:status, text: 'Hello world', account: alice)
         reply  = Fabricate(:status, text: 'Nay', thread: status, account: bob)
-        expect(FeedManager.instance.push_to_list(list, reply)).to eq true
+        expect(FeedManager.instance.push_to_list(list, reply)).to be true
       end
 
       it 'does not push replies to someone not a member of the list' do
         status = Fabricate(:status, text: 'Hello world', account: eve)
         reply  = Fabricate(:status, text: 'Nay', thread: status, account: bob)
-        expect(FeedManager.instance.push_to_list(list, reply)).to eq false
+        expect(FeedManager.instance.push_to_list(list, reply)).to be false
       end
     end
 
@@ -391,25 +393,25 @@ RSpec.describe FeedManager do
 
       it 'pushes statuses that are not replies' do
         status = Fabricate(:status, text: 'Hello world', account: bob)
-        expect(FeedManager.instance.push_to_list(list, status)).to eq true
+        expect(FeedManager.instance.push_to_list(list, status)).to be true
       end
 
       it 'pushes statuses that are replies to list owner' do
         status = Fabricate(:status, text: 'Hello world', account: owner)
         reply  = Fabricate(:status, text: 'Nay', thread: status, account: bob)
-        expect(FeedManager.instance.push_to_list(list, reply)).to eq true
+        expect(FeedManager.instance.push_to_list(list, reply)).to be true
       end
 
       it 'pushes replies to another member of the list' do
         status = Fabricate(:status, text: 'Hello world', account: alice)
         reply  = Fabricate(:status, text: 'Nay', thread: status, account: bob)
-        expect(FeedManager.instance.push_to_list(list, reply)).to eq true
+        expect(FeedManager.instance.push_to_list(list, reply)).to be true
       end
 
       it 'pushes replies to someone not a member of the list' do
         status = Fabricate(:status, text: 'Hello world', account: eve)
         reply  = Fabricate(:status, text: 'Nay', thread: status, account: bob)
-        expect(FeedManager.instance.push_to_list(list, reply)).to eq true
+        expect(FeedManager.instance.push_to_list(list, reply)).to be true
       end
     end
   end
@@ -423,7 +425,7 @@ RSpec.describe FeedManager do
 
       FeedManager.instance.merge_into_home(account, reblog.account)
 
-      expect(redis.zscore('feed:home:0', reblog.id)).to eq nil
+      expect(redis.zscore('feed:home:0', reblog.id)).to be_nil
     end
   end
 
diff --git a/spec/lib/html_aware_formatter_spec.rb b/spec/lib/html_aware_formatter_spec.rb
index 18d23abf5..315035957 100644
--- a/spec/lib/html_aware_formatter_spec.rb
+++ b/spec/lib/html_aware_formatter_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe HtmlAwareFormatter do
@@ -9,7 +11,7 @@ RSpec.describe HtmlAwareFormatter do
       let(:text) { 'Foo bar' }
 
       it 'returns formatted text' do
-        is_expected.to eq '<p>Foo bar</p>'
+        expect(subject).to eq '<p>Foo bar</p>'
       end
     end
 
@@ -20,7 +22,7 @@ RSpec.describe HtmlAwareFormatter do
         let(:text) { 'Beep boop' }
 
         it 'keeps the plain text' do
-          is_expected.to include 'Beep boop'
+          expect(subject).to include 'Beep boop'
         end
       end
 
@@ -28,7 +30,7 @@ RSpec.describe HtmlAwareFormatter do
         let(:text) { '<script>alert("Hello")</script>' }
 
         it 'strips the scripts' do
-          is_expected.to_not include '<script>alert("Hello")</script>'
+          expect(subject).to_not include '<script>alert("Hello")</script>'
         end
       end
 
@@ -36,7 +38,7 @@ RSpec.describe HtmlAwareFormatter do
         let(:text) { '<span class="mention  status__content__spoiler-link">Show more</span>' }
 
         it 'strips the malicious classes' do
-          is_expected.to_not include 'status__content__spoiler-link'
+          expect(subject).to_not include 'status__content__spoiler-link'
         end
       end
     end
diff --git a/spec/lib/link_details_extractor_spec.rb b/spec/lib/link_details_extractor_spec.rb
index 7eb15ced3..a46dd743a 100644
--- a/spec/lib/link_details_extractor_spec.rb
+++ b/spec/lib/link_details_extractor_spec.rb
@@ -1,12 +1,14 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe LinkDetailsExtractor do
+  subject { described_class.new(original_url, html, html_charset) }
+
   let(:original_url) { '' }
   let(:html) { '' }
   let(:html_charset) { nil }
 
-  subject { described_class.new(original_url, html, html_charset) }
-
   describe '#canonical_url' do
     let(:original_url) { 'https://foo.com/article?bar=baz123' }
 
diff --git a/spec/lib/ostatus/tag_manager_spec.rb b/spec/lib/ostatus/tag_manager_spec.rb
index 31195bae2..8104a7e79 100644
--- a/spec/lib/ostatus/tag_manager_spec.rb
+++ b/spec/lib/ostatus/tag_manager_spec.rb
@@ -15,15 +15,15 @@ describe OStatus::TagManager do
     end
 
     it 'returns nil if it is not local id' do
-      expect(OStatus::TagManager.instance.unique_tag_to_local_id('tag:remote,2000-01-01:objectId=12:objectType=Status', 'Status')).to eq nil
+      expect(OStatus::TagManager.instance.unique_tag_to_local_id('tag:remote,2000-01-01:objectId=12:objectType=Status', 'Status')).to be_nil
     end
 
     it 'returns nil if it is not expected type' do
-      expect(OStatus::TagManager.instance.unique_tag_to_local_id('tag:cb6e6126.ngrok.io,2000-01-01:objectId=12:objectType=Block', 'Status')).to eq nil
+      expect(OStatus::TagManager.instance.unique_tag_to_local_id('tag:cb6e6126.ngrok.io,2000-01-01:objectId=12:objectType=Block', 'Status')).to be_nil
     end
 
     it 'returns nil if it does not have object ID' do
-      expect(OStatus::TagManager.instance.unique_tag_to_local_id('tag:cb6e6126.ngrok.io,2000-01-01:objectType=Status', 'Status')).to eq nil
+      expect(OStatus::TagManager.instance.unique_tag_to_local_id('tag:cb6e6126.ngrok.io,2000-01-01:objectType=Status', 'Status')).to be_nil
     end
   end
 
@@ -45,7 +45,7 @@ describe OStatus::TagManager do
 
       it 'returns the unique tag for status' do
         expect(target.object_type).to eq :comment
-        is_expected.to eq target.uri
+        expect(subject).to eq target.uri
       end
     end
 
@@ -54,7 +54,7 @@ describe OStatus::TagManager do
 
       it 'returns the unique tag for status' do
         expect(target.object_type).to eq :note
-        is_expected.to eq target.uri
+        expect(subject).to eq target.uri
       end
     end
 
@@ -63,7 +63,7 @@ describe OStatus::TagManager do
 
       it 'returns the URL for account' do
         expect(target.object_type).to eq :person
-        is_expected.to eq 'https://cb6e6126.ngrok.io/users/alice'
+        expect(subject).to eq 'https://cb6e6126.ngrok.io/users/alice'
       end
     end
   end
diff --git a/spec/lib/plain_text_formatter_spec.rb b/spec/lib/plain_text_formatter_spec.rb
index c3d0ee630..4a0519aaf 100644
--- a/spec/lib/plain_text_formatter_spec.rb
+++ b/spec/lib/plain_text_formatter_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe PlainTextFormatter do
@@ -8,7 +10,7 @@ RSpec.describe PlainTextFormatter do
       let(:status) { Fabricate(:status, text: '<p>a text by a nerd who uses an HTML tag in text</p>', uri: nil) }
 
       it 'returns the raw text' do
-        is_expected.to eq '<p>a text by a nerd who uses an HTML tag in text</p>'
+        expect(subject).to eq '<p>a text by a nerd who uses an HTML tag in text</p>'
       end
     end
 
@@ -17,7 +19,7 @@ RSpec.describe PlainTextFormatter do
       let(:status) { Fabricate(:status, account: remote_account, text: '<p>Hello</p><script>alert("Hello")</script>') }
 
       it 'returns tag-stripped text' do
-        is_expected.to eq 'Hello'
+        expect(subject).to eq 'Hello'
       end
     end
   end
diff --git a/spec/lib/request_pool_spec.rb b/spec/lib/request_pool_spec.rb
index 4a144d7c7..63dc9c5dd 100644
--- a/spec/lib/request_pool_spec.rb
+++ b/spec/lib/request_pool_spec.rb
@@ -33,7 +33,7 @@ describe RequestPool do
 
       subject
 
-      threads = 20.times.map do |i|
+      threads = 20.times.map do |_i|
         Thread.new do
           20.times do
             subject.with('http://example.com') do |http_client|
diff --git a/spec/lib/request_spec.rb b/spec/lib/request_spec.rb
index e555a8b5a..25fe9ed37 100644
--- a/spec/lib/request_spec.rb
+++ b/spec/lib/request_spec.rb
@@ -97,12 +97,12 @@ describe Request do
   describe "response's body_with_limit method" do
     it 'rejects body more than 1 megabyte by default' do
       stub_request(:any, 'http://example.com').to_return(body: SecureRandom.random_bytes(2.megabytes))
-      expect { subject.perform { |response| response.body_with_limit } }.to raise_error Mastodon::LengthValidationError
+      expect { subject.perform(&:body_with_limit) }.to raise_error Mastodon::LengthValidationError
     end
 
     it 'accepts body less than 1 megabyte by default' do
       stub_request(:any, 'http://example.com').to_return(body: SecureRandom.random_bytes(2.kilobytes))
-      expect { subject.perform { |response| response.body_with_limit } }.not_to raise_error
+      expect { subject.perform(&:body_with_limit) }.to_not raise_error
     end
 
     it 'rejects body by given size' do
@@ -112,12 +112,12 @@ describe Request do
 
     it 'rejects too large chunked body' do
       stub_request(:any, 'http://example.com').to_return(body: SecureRandom.random_bytes(2.megabytes), headers: { 'Transfer-Encoding' => 'chunked' })
-      expect { subject.perform { |response| response.body_with_limit } }.to raise_error Mastodon::LengthValidationError
+      expect { subject.perform(&:body_with_limit) }.to raise_error Mastodon::LengthValidationError
     end
 
     it 'rejects too large monolithic body' do
       stub_request(:any, 'http://example.com').to_return(body: SecureRandom.random_bytes(2.megabytes), headers: { 'Content-Length' => 2.megabytes })
-      expect { subject.perform { |response| response.body_with_limit } }.to raise_error Mastodon::LengthValidationError
+      expect { subject.perform(&:body_with_limit) }.to raise_error Mastodon::LengthValidationError
     end
 
     it 'truncates large monolithic body' do
diff --git a/spec/lib/status_filter_spec.rb b/spec/lib/status_filter_spec.rb
index 287fe00de..08519bc59 100644
--- a/spec/lib/status_filter_spec.rb
+++ b/spec/lib/status_filter_spec.rb
@@ -10,7 +10,7 @@ describe StatusFilter do
       subject { described_class.new(status, nil) }
 
       context 'when there are no connections' do
-        it { is_expected.not_to be_filtered }
+        it { is_expected.to_not be_filtered }
       end
 
       context 'when status account is silenced' do
@@ -31,12 +31,12 @@ describe StatusFilter do
     end
 
     context 'with real account' do
-      let(:account) { Fabricate(:account) }
-
       subject { described_class.new(status, account) }
 
+      let(:account) { Fabricate(:account) }
+
       context 'when there are no connections' do
-        it { is_expected.not_to be_filtered }
+        it { is_expected.to_not be_filtered }
       end
 
       context 'when status account is blocked' do
diff --git a/spec/lib/status_reach_finder_spec.rb b/spec/lib/status_reach_finder_spec.rb
index f0c22b165..785ce28a0 100644
--- a/spec/lib/status_reach_finder_spec.rb
+++ b/spec/lib/status_reach_finder_spec.rb
@@ -5,13 +5,13 @@ require 'rails_helper'
 describe StatusReachFinder do
   describe '#inboxes' do
     context 'for a local status' do
+      subject { described_class.new(status) }
+
       let(:parent_status) { nil }
       let(:visibility) { :public }
       let(:alice) { Fabricate(:account, username: 'alice') }
       let(:status) { Fabricate(:status, account: alice, thread: parent_status, visibility: visibility) }
 
-      subject { described_class.new(status) }
-
       context 'when it contains mentions of remote accounts' do
         let(:bob) { Fabricate(:account, username: 'bob', domain: 'foo.bar', protocol: :activitypub, inbox_url: 'https://foo.bar/inbox') }
 
diff --git a/spec/lib/suspicious_sign_in_detector_spec.rb b/spec/lib/suspicious_sign_in_detector_spec.rb
index 101a18aa0..c61b1ef1e 100644
--- a/spec/lib/suspicious_sign_in_detector_spec.rb
+++ b/spec/lib/suspicious_sign_in_detector_spec.rb
@@ -1,13 +1,15 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe SuspiciousSignInDetector do
   describe '#suspicious?' do
+    subject { described_class.new(user).suspicious?(request) }
+
     let(:user) { Fabricate(:user, current_sign_in_at: 1.day.ago) }
     let(:request) { double(remote_ip: remote_ip) }
     let(:remote_ip) { nil }
 
-    subject { described_class.new(user).suspicious?(request) }
-
     context 'when user has 2FA enabled' do
       before do
         user.update!(otp_required_for_login: true)
diff --git a/spec/lib/tag_manager_spec.rb b/spec/lib/tag_manager_spec.rb
index cd9fb936c..8de290541 100644
--- a/spec/lib/tag_manager_spec.rb
+++ b/spec/lib/tag_manager_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe TagManager do
@@ -14,15 +16,15 @@ RSpec.describe TagManager do
     end
 
     it 'returns true for nil' do
-      expect(TagManager.instance.local_domain?(nil)).to eq true
+      expect(TagManager.instance.local_domain?(nil)).to be true
     end
 
     it 'returns true if the slash-stripped string equals to local domain' do
-      expect(TagManager.instance.local_domain?('DoMaIn.Example.com/')).to eq true
+      expect(TagManager.instance.local_domain?('DoMaIn.Example.com/')).to be true
     end
 
     it 'returns false for irrelevant string' do
-      expect(TagManager.instance.local_domain?('DoMaIn.Example.com!')).to eq false
+      expect(TagManager.instance.local_domain?('DoMaIn.Example.com!')).to be false
     end
   end
 
@@ -39,21 +41,21 @@ RSpec.describe TagManager do
     end
 
     it 'returns true for nil' do
-      expect(TagManager.instance.web_domain?(nil)).to eq true
+      expect(TagManager.instance.web_domain?(nil)).to be true
     end
 
     it 'returns true if the slash-stripped string equals to web domain' do
-      expect(TagManager.instance.web_domain?('DoMaIn.Example.com/')).to eq true
+      expect(TagManager.instance.web_domain?('DoMaIn.Example.com/')).to be true
     end
 
     it 'returns false for string with irrelevant characters' do
-      expect(TagManager.instance.web_domain?('DoMaIn.Example.com!')).to eq false
+      expect(TagManager.instance.web_domain?('DoMaIn.Example.com!')).to be false
     end
   end
 
   describe '#normalize_domain' do
     it 'returns nil if the given parameter is nil' do
-      expect(TagManager.instance.normalize_domain(nil)).to eq nil
+      expect(TagManager.instance.normalize_domain(nil)).to be_nil
     end
 
     it 'returns normalized domain' do
@@ -70,17 +72,17 @@ RSpec.describe TagManager do
 
     it 'returns true if the normalized string with port is local URL' do
       Rails.configuration.x.web_domain = 'domain.example.com:42'
-      expect(TagManager.instance.local_url?('https://DoMaIn.Example.com:42/')).to eq true
+      expect(TagManager.instance.local_url?('https://DoMaIn.Example.com:42/')).to be true
     end
 
     it 'returns true if the normalized string without port is local URL' do
       Rails.configuration.x.web_domain = 'domain.example.com'
-      expect(TagManager.instance.local_url?('https://DoMaIn.Example.com/')).to eq true
+      expect(TagManager.instance.local_url?('https://DoMaIn.Example.com/')).to be true
     end
 
     it 'returns false for string with irrelevant characters' do
       Rails.configuration.x.web_domain = 'domain.example.com'
-      expect(TagManager.instance.local_url?('https://domain.example.net/')).to eq false
+      expect(TagManager.instance.local_url?('https://domain.example.net/')).to be false
     end
   end
 end
diff --git a/spec/lib/text_formatter_spec.rb b/spec/lib/text_formatter_spec.rb
index d4a3a6b59..3417b450c 100644
--- a/spec/lib/text_formatter_spec.rb
+++ b/spec/lib/text_formatter_spec.rb
@@ -1,16 +1,18 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe TextFormatter do
   describe '#to_s' do
-    let(:preloaded_accounts) { nil }
-
     subject { described_class.new(text, preloaded_accounts: preloaded_accounts).to_s }
 
+    let(:preloaded_accounts) { nil }
+
     context 'given text containing plain text' do
       let(:text) { 'text' }
 
       it 'paragraphizes the text' do
-        is_expected.to eq '<p>text</p>'
+        expect(subject).to eq '<p>text</p>'
       end
     end
 
@@ -18,7 +20,7 @@ RSpec.describe TextFormatter do
       let(:text) { "line\nfeed" }
 
       it 'removes line feeds' do
-        is_expected.not_to include "\n"
+        expect(subject).to_not include "\n"
       end
     end
 
@@ -27,7 +29,7 @@ RSpec.describe TextFormatter do
       let(:text) { '@alice' }
 
       it 'creates a mention link' do
-        is_expected.to include '<a href="https://cb6e6126.ngrok.io/@alice" class="u-url mention">@<span>alice</span></a></span>'
+        expect(subject).to include '<a href="https://cb6e6126.ngrok.io/@alice" class="u-url mention">@<span>alice</span></a></span>'
       end
     end
 
@@ -36,7 +38,7 @@ RSpec.describe TextFormatter do
       let(:text) { '@alice' }
 
       it 'does not create a mention link' do
-        is_expected.to include '@alice'
+        expect(subject).to include '@alice'
       end
     end
 
@@ -44,7 +46,7 @@ RSpec.describe TextFormatter do
       let(:text) { 'https://hackernoon.com/the-power-to-build-communities-a-response-to-mark-zuckerberg-3f2cac9148a4' }
 
       it 'matches the full URL' do
-        is_expected.to include 'href="https://hackernoon.com/the-power-to-build-communities-a-response-to-mark-zuckerberg-3f2cac9148a4"'
+        expect(subject).to include 'href="https://hackernoon.com/the-power-to-build-communities-a-response-to-mark-zuckerberg-3f2cac9148a4"'
       end
     end
 
@@ -52,7 +54,7 @@ RSpec.describe TextFormatter do
       let(:text) { 'http://google.com' }
 
       it 'matches the full URL' do
-        is_expected.to include 'href="http://google.com"'
+        expect(subject).to include 'href="http://google.com"'
       end
     end
 
@@ -60,7 +62,7 @@ RSpec.describe TextFormatter do
       let(:text) { 'http://example.gay' }
 
       it 'matches the full URL' do
-        is_expected.to include 'href="http://example.gay"'
+        expect(subject).to include 'href="http://example.gay"'
       end
     end
 
@@ -68,11 +70,11 @@ RSpec.describe TextFormatter do
       let(:text) { 'https://nic.みんな/' }
 
       it 'matches the full URL' do
-        is_expected.to include 'href="https://nic.みんな/"'
+        expect(subject).to include 'href="https://nic.みんな/"'
       end
 
       it 'has display URL' do
-        is_expected.to include '<span class="">nic.みんな/</span>'
+        expect(subject).to include '<span class="">nic.みんな/</span>'
       end
     end
 
@@ -80,7 +82,7 @@ RSpec.describe TextFormatter do
       let(:text) { 'http://www.mcmansionhell.com/post/156408871451/50-states-of-mcmansion-hell-scottsdale-arizona. ' }
 
       it 'matches the full URL but not the period' do
-        is_expected.to include 'href="http://www.mcmansionhell.com/post/156408871451/50-states-of-mcmansion-hell-scottsdale-arizona"'
+        expect(subject).to include 'href="http://www.mcmansionhell.com/post/156408871451/50-states-of-mcmansion-hell-scottsdale-arizona"'
       end
     end
 
@@ -88,7 +90,7 @@ RSpec.describe TextFormatter do
       let(:text) { '(http://google.com/)' }
 
       it 'matches the full URL but not the parentheses' do
-        is_expected.to include 'href="http://google.com/"'
+        expect(subject).to include 'href="http://google.com/"'
       end
     end
 
@@ -96,7 +98,7 @@ RSpec.describe TextFormatter do
       let(:text) { 'http://www.google.com!' }
 
       it 'matches the full URL but not the exclamation point' do
-        is_expected.to include 'href="http://www.google.com"'
+        expect(subject).to include 'href="http://www.google.com"'
       end
     end
 
@@ -104,7 +106,7 @@ RSpec.describe TextFormatter do
       let(:text) { "http://www.google.com'" }
 
       it 'matches the full URL but not the single quote' do
-        is_expected.to include 'href="http://www.google.com"'
+        expect(subject).to include 'href="http://www.google.com"'
       end
     end
 
@@ -112,7 +114,7 @@ RSpec.describe TextFormatter do
       let(:text) { 'http://www.google.com>' }
 
       it 'matches the full URL but not the angle bracket' do
-        is_expected.to include 'href="http://www.google.com"'
+        expect(subject).to include 'href="http://www.google.com"'
       end
     end
 
@@ -121,7 +123,7 @@ RSpec.describe TextFormatter do
         let(:text) { 'https://www.ruby-toolbox.com/search?utf8=%E2%9C%93&q=autolink' }
 
         it 'matches the full URL' do
-          is_expected.to include 'href="https://www.ruby-toolbox.com/search?utf8=%E2%9C%93&amp;q=autolink"'
+          expect(subject).to include 'href="https://www.ruby-toolbox.com/search?utf8=%E2%9C%93&amp;q=autolink"'
         end
       end
 
@@ -129,7 +131,7 @@ RSpec.describe TextFormatter do
         let(:text) { 'https://www.ruby-toolbox.com/search?utf8=✓&q=autolink' }
 
         it 'matches the full URL' do
-          is_expected.to include 'href="https://www.ruby-toolbox.com/search?utf8=✓&amp;q=autolink"'
+          expect(subject).to include 'href="https://www.ruby-toolbox.com/search?utf8=✓&amp;q=autolink"'
         end
       end
 
@@ -137,7 +139,7 @@ RSpec.describe TextFormatter do
         let(:text) { 'https://www.ruby-toolbox.com/search?utf8=✓' }
 
         it 'matches the full URL' do
-          is_expected.to include 'href="https://www.ruby-toolbox.com/search?utf8=✓"'
+          expect(subject).to include 'href="https://www.ruby-toolbox.com/search?utf8=✓"'
         end
       end
 
@@ -145,7 +147,7 @@ RSpec.describe TextFormatter do
         let(:text) { 'https://www.ruby-toolbox.com/search?utf8=%E2%9C%93&utf81=✓&q=autolink' }
 
         it 'preserves escaped unicode characters' do
-          is_expected.to include 'href="https://www.ruby-toolbox.com/search?utf8=%E2%9C%93&amp;utf81=✓&amp;q=autolink"'
+          expect(subject).to include 'href="https://www.ruby-toolbox.com/search?utf8=%E2%9C%93&amp;utf81=✓&amp;q=autolink"'
         end
       end
     end
@@ -154,7 +156,7 @@ RSpec.describe TextFormatter do
       let(:text) { 'https://en.wikipedia.org/wiki/Diaspora_(software)' }
 
       it 'matches the full URL' do
-        is_expected.to include 'href="https://en.wikipedia.org/wiki/Diaspora_(software)"'
+        expect(subject).to include 'href="https://en.wikipedia.org/wiki/Diaspora_(software)"'
       end
     end
 
@@ -162,7 +164,7 @@ RSpec.describe TextFormatter do
       let(:text) { '"https://example.com/"' }
 
       it 'does not match the quotation marks' do
-        is_expected.to include 'href="https://example.com/"'
+        expect(subject).to include 'href="https://example.com/"'
       end
     end
 
@@ -170,7 +172,7 @@ RSpec.describe TextFormatter do
       let(:text) { '<https://example.com/>' }
 
       it 'does not match the angle brackets' do
-        is_expected.to include 'href="https://example.com/"'
+        expect(subject).to include 'href="https://example.com/"'
       end
     end
 
@@ -178,7 +180,7 @@ RSpec.describe TextFormatter do
       let(:text) { 'https://ja.wikipedia.org/wiki/日本' }
 
       it 'matches the full URL' do
-        is_expected.to include 'href="https://ja.wikipedia.org/wiki/日本"'
+        expect(subject).to include 'href="https://ja.wikipedia.org/wiki/日本"'
       end
     end
 
@@ -186,7 +188,7 @@ RSpec.describe TextFormatter do
       let(:text) { 'https://ko.wikipedia.org/wiki/대한민국' }
 
       it 'matches the full URL' do
-        is_expected.to include 'href="https://ko.wikipedia.org/wiki/대한민국"'
+        expect(subject).to include 'href="https://ko.wikipedia.org/wiki/대한민국"'
       end
     end
 
@@ -194,7 +196,7 @@ RSpec.describe TextFormatter do
       let(:text) { 'https://example.com/ abc123' }
 
       it 'does not match the full-width space' do
-        is_expected.to include 'href="https://example.com/"'
+        expect(subject).to include 'href="https://example.com/"'
       end
     end
 
@@ -202,7 +204,7 @@ RSpec.describe TextFormatter do
       let(:text) { '「[https://example.org/」' }
 
       it 'does not match the quotation marks' do
-        is_expected.to include 'href="https://example.org/"'
+        expect(subject).to include 'href="https://example.org/"'
       end
     end
 
@@ -210,7 +212,7 @@ RSpec.describe TextFormatter do
       let(:text) { 'https://baike.baidu.com/item/中华人民共和国' }
 
       it 'matches the full URL' do
-        is_expected.to include 'href="https://baike.baidu.com/item/中华人民共和国"'
+        expect(subject).to include 'href="https://baike.baidu.com/item/中华人民共和国"'
       end
     end
 
@@ -218,7 +220,7 @@ RSpec.describe TextFormatter do
       let(:text) { 'https://zh.wikipedia.org/wiki/臺灣' }
 
       it 'matches the full URL' do
-        is_expected.to include 'href="https://zh.wikipedia.org/wiki/臺灣"'
+        expect(subject).to include 'href="https://zh.wikipedia.org/wiki/臺灣"'
       end
     end
 
@@ -226,11 +228,11 @@ RSpec.describe TextFormatter do
       let(:text) { 'http://example.com/b<del>b</del>' }
 
       it 'does not include the HTML in the URL' do
-        is_expected.to include '"http://example.com/b"'
+        expect(subject).to include '"http://example.com/b"'
       end
 
       it 'escapes the HTML' do
-        is_expected.to include '&lt;del&gt;b&lt;/del&gt;'
+        expect(subject).to include '&lt;del&gt;b&lt;/del&gt;'
       end
     end
 
@@ -238,11 +240,11 @@ RSpec.describe TextFormatter do
       let(:text) { 'http://example.com/blahblahblahblah/a<script>alert("Hello")</script>' }
 
       it 'does not include the HTML in the URL' do
-        is_expected.to include '"http://example.com/blahblahblahblah/a"'
+        expect(subject).to include '"http://example.com/blahblahblahblah/a"'
       end
 
       it 'escapes the HTML' do
-        is_expected.to include '&lt;script&gt;alert(&quot;Hello&quot;)&lt;/script&gt;'
+        expect(subject).to include '&lt;script&gt;alert(&quot;Hello&quot;)&lt;/script&gt;'
       end
     end
 
@@ -250,7 +252,7 @@ RSpec.describe TextFormatter do
       let(:text) { '<script>alert("Hello")</script>' }
 
       it 'escapes the HTML' do
-        is_expected.to include '<p>&lt;script&gt;alert(&quot;Hello&quot;)&lt;/script&gt;</p>'
+        expect(subject).to include '<p>&lt;script&gt;alert(&quot;Hello&quot;)&lt;/script&gt;</p>'
       end
     end
 
@@ -258,7 +260,7 @@ RSpec.describe TextFormatter do
       let(:text) { %q{<img src="javascript:alert('XSS');">} }
 
       it 'escapes the HTML' do
-        is_expected.to include '<p>&lt;img src=&quot;javascript:alert(&#39;XSS&#39;);&quot;&gt;</p>'
+        expect(subject).to include '<p>&lt;img src=&quot;javascript:alert(&#39;XSS&#39;);&quot;&gt;</p>'
       end
     end
 
@@ -266,7 +268,7 @@ RSpec.describe TextFormatter do
       let(:text) { 'http://www\.google\.com' }
 
       it 'outputs the raw URL' do
-        is_expected.to eq '<p>http://www\.google\.com</p>'
+        expect(subject).to eq '<p>http://www\.google\.com</p>'
       end
     end
 
@@ -274,7 +276,7 @@ RSpec.describe TextFormatter do
       let(:text)  { '#hashtag' }
 
       it 'creates a hashtag link' do
-        is_expected.to include '/tags/hashtag" class="mention hashtag" rel="tag">#<span>hashtag</span></a>'
+        expect(subject).to include '/tags/hashtag" class="mention hashtag" rel="tag">#<span>hashtag</span></a>'
       end
     end
 
@@ -282,7 +284,7 @@ RSpec.describe TextFormatter do
       let(:text)  { '#hashtagタグ' }
 
       it 'creates a hashtag link' do
-        is_expected.to include '/tags/hashtag%E3%82%BF%E3%82%B0" class="mention hashtag" rel="tag">#<span>hashtagタグ</span></a>'
+        expect(subject).to include '/tags/hashtag%E3%82%BF%E3%82%B0" class="mention hashtag" rel="tag">#<span>hashtagタグ</span></a>'
       end
     end
 
@@ -290,7 +292,7 @@ RSpec.describe TextFormatter do
       let(:text) { 'xmpp:user@instance.com' }
 
       it 'matches the full URI' do
-        is_expected.to include 'href="xmpp:user@instance.com"'
+        expect(subject).to include 'href="xmpp:user@instance.com"'
       end
     end
 
@@ -298,7 +300,7 @@ RSpec.describe TextFormatter do
       let(:text) { 'please join xmpp:muc@instance.com?join right now' }
 
       it 'matches the full URI' do
-        is_expected.to include 'href="xmpp:muc@instance.com?join"'
+        expect(subject).to include 'href="xmpp:muc@instance.com?join"'
       end
     end
 
@@ -306,7 +308,7 @@ RSpec.describe TextFormatter do
       let(:text) { 'wikipedia gives this example of a magnet uri: magnet:?xt=urn:btih:c12fe1c06bba254a9dc9f519b335aa7c1367a88a' }
 
       it 'matches the full URI' do
-        is_expected.to include 'href="magnet:?xt=urn:btih:c12fe1c06bba254a9dc9f519b335aa7c1367a88a"'
+        expect(subject).to include 'href="magnet:?xt=urn:btih:c12fe1c06bba254a9dc9f519b335aa7c1367a88a"'
       end
     end
   end
diff --git a/spec/lib/user_settings_decorator_spec.rb b/spec/lib/user_settings_decorator_spec.rb
index 462c5b124..3b9b7ee2b 100644
--- a/spec/lib/user_settings_decorator_spec.rb
+++ b/spec/lib/user_settings_decorator_spec.rb
@@ -11,14 +11,14 @@ describe UserSettingsDecorator do
       values = { 'notification_emails' => { 'follow' => '1' } }
 
       settings.update(values)
-      expect(user.settings['notification_emails']['follow']).to eq true
+      expect(user.settings['notification_emails']['follow']).to be true
     end
 
     it 'updates the user settings value for interactions' do
       values = { 'interactions' => { 'must_be_follower' => '0' } }
 
       settings.update(values)
-      expect(user.settings['interactions']['must_be_follower']).to eq false
+      expect(user.settings['interactions']['must_be_follower']).to be false
     end
 
     it 'updates the user settings value for privacy' do
@@ -32,42 +32,42 @@ describe UserSettingsDecorator do
       values = { 'setting_default_sensitive' => '1' }
 
       settings.update(values)
-      expect(user.settings['default_sensitive']).to eq true
+      expect(user.settings['default_sensitive']).to be true
     end
 
     it 'updates the user settings value for unfollow modal' do
       values = { 'setting_unfollow_modal' => '0' }
 
       settings.update(values)
-      expect(user.settings['unfollow_modal']).to eq false
+      expect(user.settings['unfollow_modal']).to be false
     end
 
     it 'updates the user settings value for boost modal' do
       values = { 'setting_boost_modal' => '1' }
 
       settings.update(values)
-      expect(user.settings['boost_modal']).to eq true
+      expect(user.settings['boost_modal']).to be true
     end
 
     it 'updates the user settings value for delete toot modal' do
       values = { 'setting_delete_modal' => '0' }
 
       settings.update(values)
-      expect(user.settings['delete_modal']).to eq false
+      expect(user.settings['delete_modal']).to be false
     end
 
     it 'updates the user settings value for gif auto play' do
       values = { 'setting_auto_play_gif' => '0' }
 
       settings.update(values)
-      expect(user.settings['auto_play_gif']).to eq false
+      expect(user.settings['auto_play_gif']).to be false
     end
 
     it 'updates the user settings value for system font in UI' do
       values = { 'setting_system_font_ui' => '0' }
 
       settings.update(values)
-      expect(user.settings['system_font_ui']).to eq false
+      expect(user.settings['system_font_ui']).to be false
     end
 
     it 'decoerces setting values before applying' do
@@ -77,8 +77,8 @@ describe UserSettingsDecorator do
       }
 
       settings.update(values)
-      expect(user.settings['delete_modal']).to eq false
-      expect(user.settings['boost_modal']).to eq true
+      expect(user.settings['delete_modal']).to be false
+      expect(user.settings['boost_modal']).to be true
     end
   end
 end
diff --git a/spec/lib/vacuum/access_tokens_vacuum_spec.rb b/spec/lib/vacuum/access_tokens_vacuum_spec.rb
index 0244c3449..6b7234065 100644
--- a/spec/lib/vacuum/access_tokens_vacuum_spec.rb
+++ b/spec/lib/vacuum/access_tokens_vacuum_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe Vacuum::AccessTokensVacuum do
diff --git a/spec/lib/vacuum/backups_vacuum_spec.rb b/spec/lib/vacuum/backups_vacuum_spec.rb
index 4e2de083f..867dbe402 100644
--- a/spec/lib/vacuum/backups_vacuum_spec.rb
+++ b/spec/lib/vacuum/backups_vacuum_spec.rb
@@ -1,10 +1,12 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe Vacuum::BackupsVacuum do
-  let(:retention_period) { 7.days }
-
   subject { described_class.new(retention_period) }
 
+  let(:retention_period) { 7.days }
+
   describe '#perform' do
     let!(:expired_backup) { Fabricate(:backup, created_at: (retention_period + 1.day).ago) }
     let!(:current_backup) { Fabricate(:backup) }
diff --git a/spec/lib/vacuum/feeds_vacuum_spec.rb b/spec/lib/vacuum/feeds_vacuum_spec.rb
index 0aec26740..ede1e3c36 100644
--- a/spec/lib/vacuum/feeds_vacuum_spec.rb
+++ b/spec/lib/vacuum/feeds_vacuum_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe Vacuum::FeedsVacuum do
diff --git a/spec/lib/vacuum/media_attachments_vacuum_spec.rb b/spec/lib/vacuum/media_attachments_vacuum_spec.rb
index be8458d9b..3c17ecb00 100644
--- a/spec/lib/vacuum/media_attachments_vacuum_spec.rb
+++ b/spec/lib/vacuum/media_attachments_vacuum_spec.rb
@@ -1,10 +1,11 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe Vacuum::MediaAttachmentsVacuum do
-  let(:retention_period) { 7.days }
-
   subject { described_class.new(retention_period) }
 
+  let(:retention_period) { 7.days }
   let(:remote_status) { Fabricate(:status, account: Fabricate(:account, domain: 'example.com')) }
   let(:local_status) { Fabricate(:status) }
 
diff --git a/spec/lib/vacuum/preview_cards_vacuum_spec.rb b/spec/lib/vacuum/preview_cards_vacuum_spec.rb
index 275f9ba92..c1b7f7e9c 100644
--- a/spec/lib/vacuum/preview_cards_vacuum_spec.rb
+++ b/spec/lib/vacuum/preview_cards_vacuum_spec.rb
@@ -1,10 +1,12 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe Vacuum::PreviewCardsVacuum do
-  let(:retention_period) { 7.days }
-
   subject { described_class.new(retention_period) }
 
+  let(:retention_period) { 7.days }
+
   describe '#perform' do
     let!(:orphaned_preview_card) { Fabricate(:preview_card, created_at: 2.days.ago) }
     let!(:old_preview_card) { Fabricate(:preview_card, updated_at: (retention_period + 1.day).ago) }
diff --git a/spec/lib/vacuum/statuses_vacuum_spec.rb b/spec/lib/vacuum/statuses_vacuum_spec.rb
index 83f3c5c9f..d5c013950 100644
--- a/spec/lib/vacuum/statuses_vacuum_spec.rb
+++ b/spec/lib/vacuum/statuses_vacuum_spec.rb
@@ -1,12 +1,14 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe Vacuum::StatusesVacuum do
+  subject { described_class.new(retention_period) }
+
   let(:retention_period) { 7.days }
 
   let(:remote_account) { Fabricate(:account, domain: 'example.com') }
 
-  subject { described_class.new(retention_period) }
-
   describe '#perform' do
     let!(:remote_status_old) { Fabricate(:status, account: remote_account, created_at: (retention_period + 2.days).ago) }
     let!(:remote_status_recent) { Fabricate(:status, account: remote_account, created_at: (retention_period - 2.days).ago) }
diff --git a/spec/lib/vacuum/system_keys_vacuum_spec.rb b/spec/lib/vacuum/system_keys_vacuum_spec.rb
index 565892f02..84cae3041 100644
--- a/spec/lib/vacuum/system_keys_vacuum_spec.rb
+++ b/spec/lib/vacuum/system_keys_vacuum_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe Vacuum::SystemKeysVacuum do
diff --git a/spec/lib/webfinger_resource_spec.rb b/spec/lib/webfinger_resource_spec.rb
index ee007da70..8ec6dd205 100644
--- a/spec/lib/webfinger_resource_spec.rb
+++ b/spec/lib/webfinger_resource_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 describe WebfingerResource do