about summary refs log tree commit diff
path: root/spec/controllers/auth/registrations_controller_spec.rb
diff options
context:
space:
mode:
authorNick Schonning <nschonni@gmail.com>2023-02-19 23:24:14 -0500
committerGitHub <noreply@github.com>2023-02-20 13:24:14 +0900
commit4552685f6bd400666ec4058783eeabb11568e575 (patch)
treeab708e0d54b9309f96ef0e4d17e8afd32221c5c6 /spec/controllers/auth/registrations_controller_spec.rb
parent4ea1e0fceb0c0c5fee014a99f81f8f13a16f6dde (diff)
Autofix Rubocop RSpec/LeadingSubject (#23670)
Diffstat (limited to 'spec/controllers/auth/registrations_controller_spec.rb')
-rw-r--r--spec/controllers/auth/registrations_controller_spec.rb64
1 files changed, 32 insertions, 32 deletions
diff --git a/spec/controllers/auth/registrations_controller_spec.rb b/spec/controllers/auth/registrations_controller_spec.rb
index 52023eb2e..8cfb8e277 100644
--- a/spec/controllers/auth/registrations_controller_spec.rb
+++ b/spec/controllers/auth/registrations_controller_spec.rb
@@ -95,18 +95,18 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
     before { request.env['devise.mapping'] = Devise.mappings[:user] }
 
     context do
-      around do |example|
-        registrations_mode = Setting.registrations_mode
-        example.run
-        Setting.registrations_mode = registrations_mode
-      end
-
       subject do
         Setting.registrations_mode = 'open'
         request.headers['Accept-Language'] = accept_language
         post :create, params: { user: { account_attributes: { username: 'test' }, email: 'test@example.com', password: '12345678', password_confirmation: '12345678', agreement: 'true' } }
       end
 
+      around do |example|
+        registrations_mode = Setting.registrations_mode
+        example.run
+        Setting.registrations_mode = registrations_mode
+      end
+
       it 'redirects to setup' do
         subject
         expect(response).to redirect_to auth_setup_path
@@ -121,18 +121,18 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
     end
 
     context 'when user has not agreed to terms of service' do
-      around do |example|
-        registrations_mode = Setting.registrations_mode
-        example.run
-        Setting.registrations_mode = registrations_mode
-      end
-
       subject do
         Setting.registrations_mode = 'open'
         request.headers['Accept-Language'] = accept_language
         post :create, params: { user: { account_attributes: { username: 'test' }, email: 'test@example.com', password: '12345678', password_confirmation: '12345678', agreement: 'false' } }
       end
 
+      around do |example|
+        registrations_mode = Setting.registrations_mode
+        example.run
+        Setting.registrations_mode = registrations_mode
+      end
+
       it 'does not create user' do
         subject
         user = User.find_by(email: 'test@example.com')
@@ -141,18 +141,18 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
     end
 
     context 'approval-based registrations without invite' do
-      around do |example|
-        registrations_mode = Setting.registrations_mode
-        example.run
-        Setting.registrations_mode = registrations_mode
-      end
-
       subject do
         Setting.registrations_mode = 'approved'
         request.headers['Accept-Language'] = accept_language
         post :create, params: { user: { account_attributes: { username: 'test' }, email: 'test@example.com', password: '12345678', password_confirmation: '12345678', agreement: 'true' } }
       end
 
+      around do |example|
+        registrations_mode = Setting.registrations_mode
+        example.run
+        Setting.registrations_mode = registrations_mode
+      end
+
       it 'redirects to setup' do
         subject
         expect(response).to redirect_to auth_setup_path
@@ -168,12 +168,6 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
     end
 
     context 'approval-based registrations with expired invite' do
-      around do |example|
-        registrations_mode = Setting.registrations_mode
-        example.run
-        Setting.registrations_mode = registrations_mode
-      end
-
       subject do
         Setting.registrations_mode = 'approved'
         request.headers['Accept-Language'] = accept_language
@@ -181,6 +175,12 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
         post :create, params: { user: { account_attributes: { username: 'test' }, email: 'test@example.com', password: '12345678', password_confirmation: '12345678', invite_code: invite.code, agreement: 'true' } }
       end
 
+      around do |example|
+        registrations_mode = Setting.registrations_mode
+        example.run
+        Setting.registrations_mode = registrations_mode
+      end
+
       it 'redirects to setup' do
         subject
         expect(response).to redirect_to auth_setup_path
@@ -196,14 +196,6 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
     end
 
     context 'approval-based registrations with valid invite and required invite text' do
-      around do |example|
-        registrations_mode = Setting.registrations_mode
-        require_invite_text = Setting.require_invite_text
-        example.run
-        Setting.require_invite_text = require_invite_text
-        Setting.registrations_mode = registrations_mode
-      end
-
       subject do
         inviter = Fabricate(:user, confirmed_at: 2.days.ago)
         Setting.registrations_mode = 'approved'
@@ -213,6 +205,14 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
         post :create, params: { user: { account_attributes: { username: 'test' }, email: 'test@example.com', password: '12345678', password_confirmation: '12345678', invite_code: invite.code, agreement: 'true' } }
       end
 
+      around do |example|
+        registrations_mode = Setting.registrations_mode
+        require_invite_text = Setting.require_invite_text
+        example.run
+        Setting.require_invite_text = require_invite_text
+        Setting.registrations_mode = registrations_mode
+      end
+
       it 'redirects to setup' do
         subject
         expect(response).to redirect_to auth_setup_path