0
0
Fork 0

Autofix Rubocop Style/StringLiterals (#23695)

This commit is contained in:
Nick Schonning 2023-02-18 17:38:14 -05:00 committed by GitHub
parent ac3561098e
commit 81ad6c2e39
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
76 changed files with 277 additions and 359 deletions

View file

@ -9,8 +9,8 @@ RSpec.describe Admin::ChangeEmailsController, type: :controller do
sign_in admin
end
describe "GET #show" do
it "returns http success" do
describe 'GET #show' do
it 'returns http success' do
user = Fabricate(:user)
get :show, params: { account_id: user.account.id }
@ -19,12 +19,12 @@ RSpec.describe Admin::ChangeEmailsController, type: :controller do
end
end
describe "GET #update" do
describe 'GET #update' do
before do
allow(UserMailer).to receive(:confirmation_instructions).and_return(double('email', deliver_later: nil))
end
it "returns http success" do
it 'returns http success' do
user = Fabricate(:user)
previous_email = user.email

View file

@ -38,7 +38,7 @@ describe Api::V1::StreamingController do
[:scheme, :path, :query, :fragment].each do |part|
expect(redirect_to_uri.send(part)).to eq(request_uri.send(part)), "redirect target #{part}"
end
expect(redirect_to_uri.host).to eq(@streaming_host), "redirect target host"
expect(redirect_to_uri.host).to eq(@streaming_host), 'redirect target host'
end
end
end

View file

@ -27,7 +27,7 @@ describe ApplicationController, type: :controller do
expect(response).to have_http_status(code)
end
it "renders template for http" do
it 'renders template for http' do
is_expected.to render_template("errors/#{code}", layout: 'error')
end
end
@ -146,7 +146,7 @@ describe ApplicationController, type: :controller do
end
it 'does not store location for user if it is devise controller' do
@request.env["devise.mapping"] = Devise.mappings[:user]
@request.env['devise.mapping'] = Devise.mappings[:user]
get 'create'
expect(controller.stored_location_for(:user)).to be_nil
end

View file

@ -32,7 +32,7 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
describe 'GET #edit' do
it 'returns http success' do
request.env["devise.mapping"] = Devise.mappings[:user]
request.env['devise.mapping'] = Devise.mappings[:user]
sign_in(Fabricate(:user))
get :edit
expect(response).to have_http_status(200)
@ -41,7 +41,7 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
describe 'GET #update' do
it 'returns http success' do
request.env["devise.mapping"] = Devise.mappings[:user]
request.env['devise.mapping'] = Devise.mappings[:user]
sign_in(Fabricate(:user), scope: :user)
post :update
expect(response).to have_http_status(200)
@ -49,7 +49,7 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
context 'when suspended' do
it 'returns http forbidden' do
request.env["devise.mapping"] = Devise.mappings[:user]
request.env['devise.mapping'] = Devise.mappings[:user]
sign_in(Fabricate(:user, account_attributes: { username: 'test', suspended_at: Time.now.utc }), scope: :user)
post :update
expect(response).to have_http_status(403)
@ -59,7 +59,7 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
describe 'GET #new' do
before do
request.env["devise.mapping"] = Devise.mappings[:user]
request.env['devise.mapping'] = Devise.mappings[:user]
end
context do
@ -92,7 +92,7 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
I18n.locale = current_locale
end
before { request.env["devise.mapping"] = Devise.mappings[:user] }
before { request.env['devise.mapping'] = Devise.mappings[:user] }
context do
around do |example|
@ -103,7 +103,7 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
subject do
Setting.registrations_mode = 'open'
request.headers["Accept-Language"] = accept_language
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
@ -129,7 +129,7 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
subject do
Setting.registrations_mode = 'open'
request.headers["Accept-Language"] = accept_language
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
@ -149,7 +149,7 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
subject do
Setting.registrations_mode = 'approved'
request.headers["Accept-Language"] = accept_language
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
@ -176,7 +176,7 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
subject do
Setting.registrations_mode = 'approved'
request.headers["Accept-Language"] = accept_language
request.headers['Accept-Language'] = accept_language
invite = Fabricate(:invite, max_uses: nil, expires_at: 1.hour.ago)
post :create, params: { user: { account_attributes: { username: 'test' }, email: 'test@example.com', password: '12345678', password_confirmation: '12345678', invite_code: invite.code, agreement: 'true' } }
end
@ -208,7 +208,7 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
inviter = Fabricate(:user, confirmed_at: 2.days.ago)
Setting.registrations_mode = 'approved'
Setting.require_invite_text = true
request.headers["Accept-Language"] = accept_language
request.headers['Accept-Language'] = accept_language
invite = Fabricate(:invite, user: inviter, max_uses: nil, expires_at: 1.hour.from_now)
post :create, params: { user: { account_attributes: { username: 'test' }, email: 'test@example.com', password: '12345678', password_confirmation: '12345678', invite_code: invite.code, agreement: 'true' } }
end

View file

@ -54,7 +54,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
context 'using PAM authentication', if: ENV['PAM_ENABLED'] == 'true' do
context 'using a valid password' do
before do
post :create, params: { user: { email: "pam_user1", password: '123456' } }
post :create, params: { user: { email: 'pam_user1', password: '123456' } }
end
it 'redirects to home' do
@ -68,7 +68,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
context 'using an invalid password' do
before do
post :create, params: { user: { email: "pam_user1", password: 'WRONGPW' } }
post :create, params: { user: { email: 'pam_user1', password: 'WRONGPW' } }
end
it 'shows a login error' do
@ -194,7 +194,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
post :create, params: { user: { email: user.email, password: user.password } }
end
context "in single user mode" do
context 'in single user mode' do
let(:single_user_mode) { true }
it 'redirects to home' do
@ -202,7 +202,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
end
end
context "in non-single user mode" do
context 'in non-single user mode' do
let(:single_user_mode) { false }
it "redirects back to the user's page" do
@ -230,8 +230,8 @@ RSpec.describe Auth::SessionsController, type: :controller do
end
it 'renders two factor authentication page' do
expect(controller).to render_template("two_factor")
expect(controller).to render_template(partial: "_otp_authentication_form")
expect(controller).to render_template('two_factor')
expect(controller).to render_template(partial: '_otp_authentication_form')
end
end
@ -246,8 +246,8 @@ RSpec.describe Auth::SessionsController, type: :controller do
end
it 'renders two factor authentication page' do
expect(controller).to render_template("two_factor")
expect(controller).to render_template(partial: "_otp_authentication_form")
expect(controller).to render_template('two_factor')
expect(controller).to render_template(partial: '_otp_authentication_form')
end
end
@ -257,8 +257,8 @@ RSpec.describe Auth::SessionsController, type: :controller do
end
it 'renders two factor authentication page' do
expect(controller).to render_template("two_factor")
expect(controller).to render_template(partial: "_otp_authentication_form")
expect(controller).to render_template('two_factor')
expect(controller).to render_template(partial: '_otp_authentication_form')
end
end
@ -359,8 +359,8 @@ RSpec.describe Auth::SessionsController, type: :controller do
end
it 'renders webauthn authentication page' do
expect(controller).to render_template("two_factor")
expect(controller).to render_template(partial: "_webauthn_form")
expect(controller).to render_template('two_factor')
expect(controller).to render_template(partial: '_webauthn_form')
end
end
@ -370,8 +370,8 @@ RSpec.describe Auth::SessionsController, type: :controller do
end
it 'renders webauthn authentication page' do
expect(controller).to render_template("two_factor")
expect(controller).to render_template(partial: "_webauthn_form")
expect(controller).to render_template('two_factor')
expect(controller).to render_template(partial: '_webauthn_form')
end
end

View file

@ -13,7 +13,7 @@ describe Oauth::AuthorizedApplicationsController do
shared_examples 'stores location for user' do
it 'stores location for user' do
subject
expect(controller.stored_location_for(:user)).to eq "/oauth/authorized_applications"
expect(controller.stored_location_for(:user)).to eq '/oauth/authorized_applications'
end
end

View file

@ -7,8 +7,8 @@ RSpec.describe Settings::ImportsController, type: :controller do
sign_in Fabricate(:user), scope: :user
end
describe "GET #show" do
it "returns http success" do
describe 'GET #show' do
it 'returns http success' do
get :show
expect(response).to have_http_status(200)
end

View file

@ -10,8 +10,8 @@ RSpec.describe Settings::ProfilesController, type: :controller do
sign_in user, scope: :user
end
describe "GET #show" do
it "returns http success" do
describe 'GET #show' do
it 'returns http success' do
get :show
expect(response).to have_http_status(200)
end

View file

@ -137,7 +137,7 @@ describe Settings::TwoFactorAuthentication::WebauthnCredentialsController do
expect { get :options }.to_not change { user.webauthn_id }
end
it "includes existing credentials in list of excluded credentials" do
it 'includes existing credentials in list of excluded credentials' do
get :options
excluded_credentials_ids = JSON.parse(response.body)['excludeCredentials'].map { |credential| credential['id'] }

View file

@ -8,8 +8,8 @@ RSpec.describe StatusesCleanupController, type: :controller do
sign_in @user, scope: :user
end
describe "GET #show" do
it "returns http success" do
describe 'GET #show' do
it 'returns http success' do
get :show
expect(response).to have_http_status(200)
end

View file

@ -27,8 +27,8 @@ describe WellKnown::NodeInfoController, type: :controller do
json = body_as_json
expect({ "foo" => 0 }).not_to match_json_schema("nodeinfo_2.0")
expect(json).to match_json_schema("nodeinfo_2.0")
expect({ 'foo' => 0 }).not_to match_json_schema('nodeinfo_2.0')
expect(json).to match_json_schema('nodeinfo_2.0')
expect(json[:version]).to eq '2.0'
expect(json[:usage]).to be_a Hash
expect(json[:software]).to be_a Hash