about summary refs log tree commit diff
path: root/spec/controllers
diff options
context:
space:
mode:
authorNick Schonning <nschonni@gmail.com>2023-02-19 21:17:41 -0500
committerGitHub <noreply@github.com>2023-02-20 11:17:41 +0900
commit5179c47087e7807162f1466ec61a797586de007f (patch)
tree106d584a459714b39a3b2fe1a87492fa2cdedc74 /spec/controllers
parentaef0051fd0723ff03175a8851497056ed07d1a83 (diff)
Autofix Rubocops RSpec/ScatteredLet (#23725)
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/admin/domain_blocks_controller_spec.rb9
-rw-r--r--spec/controllers/api/v1/admin/domain_blocks_controller_spec.rb9
-rw-r--r--spec/controllers/api/v1/push/subscriptions_controller_spec.rb14
3 files changed, 14 insertions, 18 deletions
diff --git a/spec/controllers/admin/domain_blocks_controller_spec.rb b/spec/controllers/admin/domain_blocks_controller_spec.rb
index 92fc19efa..d58a0cafc 100644
--- a/spec/controllers/admin/domain_blocks_controller_spec.rb
+++ b/spec/controllers/admin/domain_blocks_controller_spec.rb
@@ -72,16 +72,15 @@ RSpec.describe Admin::DomainBlocksController, type: :controller do
 
   describe 'PUT #update' do
     let!(:remote_account) { Fabricate(:account, domain: 'example.com') }
-    let(:domain_block)    { Fabricate(:domain_block, domain: 'example.com', severity: original_severity) }
+    let(:subject) do
+      post :update, params: { id: domain_block.id, domain_block: { domain: 'example.com', severity: new_severity } }
+    end
+    let(:domain_block) { Fabricate(:domain_block, domain: 'example.com', severity: original_severity) }
 
     before do
       BlockDomainService.new.call(domain_block)
     end
 
-    let(:subject) do
-      post :update, params: { id: domain_block.id, domain_block: { domain: 'example.com', severity: new_severity } }
-    end
-
     context 'downgrading a domain suspension to silence' do
       let(:original_severity) { 'suspend' }
       let(:new_severity)      { 'silence' }
diff --git a/spec/controllers/api/v1/admin/domain_blocks_controller_spec.rb b/spec/controllers/api/v1/admin/domain_blocks_controller_spec.rb
index 606def602..b367ab9ce 100644
--- a/spec/controllers/api/v1/admin/domain_blocks_controller_spec.rb
+++ b/spec/controllers/api/v1/admin/domain_blocks_controller_spec.rb
@@ -73,16 +73,15 @@ RSpec.describe Api::V1::Admin::DomainBlocksController, type: :controller do
 
   describe 'PUT #update' do
     let!(:remote_account) { Fabricate(:account, domain: 'example.com') }
-    let(:domain_block)    { Fabricate(:domain_block, domain: 'example.com', severity: original_severity) }
+    let(:subject) do
+      post :update, params: { id: domain_block.id, domain: 'example.com', severity: new_severity }
+    end
+    let(:domain_block) { Fabricate(:domain_block, domain: 'example.com', severity: original_severity) }
 
     before do
       BlockDomainService.new.call(domain_block)
     end
 
-    let(:subject) do
-      post :update, params: { id: domain_block.id, domain: 'example.com', severity: new_severity }
-    end
-
     context 'downgrading a domain suspension to silence' do
       let(:original_severity) { 'suspend' }
       let(:new_severity)      { 'silence' }
diff --git a/spec/controllers/api/v1/push/subscriptions_controller_spec.rb b/spec/controllers/api/v1/push/subscriptions_controller_spec.rb
index 67f09da2d..168191468 100644
--- a/spec/controllers/api/v1/push/subscriptions_controller_spec.rb
+++ b/spec/controllers/api/v1/push/subscriptions_controller_spec.rb
@@ -5,13 +5,7 @@ require 'rails_helper'
 describe Api::V1::Push::SubscriptionsController do
   render_views
 
-  let(:user)  { Fabricate(:user) }
-  let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'push') }
-
-  before do
-    allow(controller).to receive(:doorkeeper_token) { token }
-  end
-
+  let(:user) { Fabricate(:user) }
   let(:create_payload) do
     {
       subscription: {
@@ -23,7 +17,6 @@ describe Api::V1::Push::SubscriptionsController do
       },
     }.with_indifferent_access
   end
-
   let(:alerts_payload) do
     {
       data: {
@@ -41,6 +34,11 @@ describe Api::V1::Push::SubscriptionsController do
       },
     }.with_indifferent_access
   end
+  let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'push') }
+
+  before do
+    allow(controller).to receive(:doorkeeper_token) { token }
+  end
 
   describe 'POST #create' do
     before do