0
0
Fork 0

Remove unneeded settings cleanup from specs (#28425)

This commit is contained in:
Claire 2023-12-19 16:17:22 +01:00 committed by GitHub
parent c7c727994a
commit 6fed0fcbaa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 8 additions and 189 deletions

View file

@ -6,12 +6,6 @@ RSpec.describe Auth::RegistrationsController do
render_views
shared_examples 'checks for enabled registrations' do |path|
around do |example|
registrations_mode = Setting.registrations_mode
example.run
Setting.registrations_mode = registrations_mode
end
it 'redirects if it is in single user mode while it is open for registration' do
Fabricate(:account)
Setting.registrations_mode = 'open'
@ -82,12 +76,6 @@ RSpec.describe Auth::RegistrationsController do
end
context 'with open registrations' do
around do |example|
registrations_mode = Setting.registrations_mode
example.run
Setting.registrations_mode = registrations_mode
end
it 'returns http success' do
Setting.registrations_mode = 'open'
get :new
@ -120,12 +108,6 @@ RSpec.describe Auth::RegistrationsController do
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
@ -146,12 +128,6 @@ RSpec.describe Auth::RegistrationsController do
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')
@ -166,12 +142,6 @@ RSpec.describe Auth::RegistrationsController do
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
@ -194,12 +164,6 @@ RSpec.describe Auth::RegistrationsController 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
@ -224,14 +188,6 @@ RSpec.describe Auth::RegistrationsController 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