about summary refs log tree commit diff
path: root/spec/models/account_statuses_cleanup_policy_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/account_statuses_cleanup_policy_spec.rb')
-rw-r--r--spec/models/account_statuses_cleanup_policy_spec.rb61
1 files changed, 30 insertions, 31 deletions
diff --git a/spec/models/account_statuses_cleanup_policy_spec.rb b/spec/models/account_statuses_cleanup_policy_spec.rb
index b01321a20..d3c011b3a 100644
--- a/spec/models/account_statuses_cleanup_policy_spec.rb
+++ b/spec/models/account_statuses_cleanup_policy_spec.rb
@@ -16,16 +16,15 @@ RSpec.describe AccountStatusesCleanupPolicy, type: :model do
     context 'when widening a policy' do
       let!(:account_statuses_cleanup_policy) do
         Fabricate(:account_statuses_cleanup_policy,
-          account: account,
-          keep_direct: true,
-          keep_pinned: true,
-          keep_polls: true,
-          keep_media: true,
-          keep_self_fav: true,
-          keep_self_bookmark: true,
-          min_favs: 1,
-          min_reblogs: 1
-        )
+                  account: account,
+                  keep_direct: true,
+                  keep_pinned: true,
+                  keep_polls: true,
+                  keep_media: true,
+                  keep_self_fav: true,
+                  keep_self_bookmark: true,
+                  min_favs: 1,
+                  min_reblogs: 1)
       end
 
       before do
@@ -35,77 +34,76 @@ RSpec.describe AccountStatusesCleanupPolicy, type: :model do
       it 'invalidates last_inspected when widened because of keep_direct' do
         account_statuses_cleanup_policy.keep_direct = false
         account_statuses_cleanup_policy.save
-        expect(account_statuses_cleanup_policy.last_inspected).to be nil
+        expect(account_statuses_cleanup_policy.last_inspected).to be_nil
       end
 
       it 'invalidates last_inspected when widened because of keep_pinned' do
         account_statuses_cleanup_policy.keep_pinned = false
         account_statuses_cleanup_policy.save
-        expect(account_statuses_cleanup_policy.last_inspected).to be nil
+        expect(account_statuses_cleanup_policy.last_inspected).to be_nil
       end
 
       it 'invalidates last_inspected when widened because of keep_polls' do
         account_statuses_cleanup_policy.keep_polls = false
         account_statuses_cleanup_policy.save
-        expect(account_statuses_cleanup_policy.last_inspected).to be nil
+        expect(account_statuses_cleanup_policy.last_inspected).to be_nil
       end
 
       it 'invalidates last_inspected when widened because of keep_media' do
         account_statuses_cleanup_policy.keep_media = false
         account_statuses_cleanup_policy.save
-        expect(account_statuses_cleanup_policy.last_inspected).to be nil
+        expect(account_statuses_cleanup_policy.last_inspected).to be_nil
       end
 
       it 'invalidates last_inspected when widened because of keep_self_fav' do
         account_statuses_cleanup_policy.keep_self_fav = false
         account_statuses_cleanup_policy.save
-        expect(account_statuses_cleanup_policy.last_inspected).to be nil
+        expect(account_statuses_cleanup_policy.last_inspected).to be_nil
       end
 
       it 'invalidates last_inspected when widened because of keep_self_bookmark' do
         account_statuses_cleanup_policy.keep_self_bookmark = false
         account_statuses_cleanup_policy.save
-        expect(account_statuses_cleanup_policy.last_inspected).to be nil
+        expect(account_statuses_cleanup_policy.last_inspected).to be_nil
       end
 
       it 'invalidates last_inspected when widened because of higher min_favs' do
         account_statuses_cleanup_policy.min_favs = 5
         account_statuses_cleanup_policy.save
-        expect(account_statuses_cleanup_policy.last_inspected).to be nil
+        expect(account_statuses_cleanup_policy.last_inspected).to be_nil
       end
 
       it 'invalidates last_inspected when widened because of disabled min_favs' do
         account_statuses_cleanup_policy.min_favs = nil
         account_statuses_cleanup_policy.save
-        expect(account_statuses_cleanup_policy.last_inspected).to be nil
+        expect(account_statuses_cleanup_policy.last_inspected).to be_nil
       end
 
       it 'invalidates last_inspected when widened because of higher min_reblogs' do
         account_statuses_cleanup_policy.min_reblogs = 5
         account_statuses_cleanup_policy.save
-        expect(account_statuses_cleanup_policy.last_inspected).to be nil
+        expect(account_statuses_cleanup_policy.last_inspected).to be_nil
       end
 
       it 'invalidates last_inspected when widened because of disable min_reblogs' do
         account_statuses_cleanup_policy.min_reblogs = nil
         account_statuses_cleanup_policy.save
-        expect(account_statuses_cleanup_policy.last_inspected).to be nil
+        expect(account_statuses_cleanup_policy.last_inspected).to be_nil
       end
     end
 
     context 'when narrowing a policy' do
       let!(:account_statuses_cleanup_policy) do
         Fabricate(:account_statuses_cleanup_policy,
-          account: account,
-          keep_direct: false,
-          keep_pinned: false,
-          keep_polls: false,
-          keep_media: false,
-          keep_self_fav: false,
-          keep_self_bookmark: false,
-          min_favs: nil,
-          min_reblogs: nil
-        )
+                  account: account,
+                  keep_direct: false,
+                  keep_pinned: false,
+                  keep_polls: false,
+                  keep_media: false,
+                  keep_self_fav: false,
+                  keep_self_bookmark: false,
+                  min_favs: nil,
+                  min_reblogs: nil)
       end
 
       it 'does not unnecessarily invalidate last_inspected' do
@@ -136,6 +134,7 @@ RSpec.describe AccountStatusesCleanupPolicy, type: :model do
   describe '#invalidate_last_inspected' do
     let(:account_statuses_cleanup_policy) { Fabricate(:account_statuses_cleanup_policy, account: account) }
     let(:status) { Fabricate(:status, id: 10, account: account) }
+
     subject { account_statuses_cleanup_policy.invalidate_last_inspected(status, action) }
 
     before do
@@ -232,7 +231,7 @@ RSpec.describe AccountStatusesCleanupPolicy, type: :model do
   end
 
   describe '#compute_cutoff_id' do
-    let!(:unrelated_status)  { Fabricate(:status, created_at: 3.years.ago) }
+    let!(:unrelated_status) { Fabricate(:status, created_at: 3.years.ago) }
     let(:account_statuses_cleanup_policy) { Fabricate(:account_statuses_cleanup_policy, account: account) }
 
     subject { account_statuses_cleanup_policy.compute_cutoff_id }