Autofix Rubocop RSpec/LeadingSubject (#23670)
This commit is contained in:
parent
4ea1e0fceb
commit
4552685f6b
78 changed files with 256 additions and 338 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue