Merge remote-tracking branch 'parent/main' into kbtopic-remove-quote

This commit is contained in:
KMY 2025-04-26 08:30:17 +09:00
commit 80542ea172
76 changed files with 658 additions and 390 deletions

View file

@ -23,7 +23,7 @@ RSpec.describe ApplicationController do
end
end
shared_examples 'respond_with_error' do |code|
shared_examples 'error response' do |code|
it "returns http #{code} for http and renders template" do
subject
@ -51,7 +51,7 @@ RSpec.describe ApplicationController do
post 'success'
end
include_examples 'respond_with_error', 422
it_behaves_like 'error response', 422
end
describe 'helper_method :current_account' do
@ -123,7 +123,7 @@ RSpec.describe ApplicationController do
get 'routing_error'
end
include_examples 'respond_with_error', 404
it_behaves_like 'error response', 404
end
context 'with ActiveRecord::RecordNotFound' do
@ -132,7 +132,7 @@ RSpec.describe ApplicationController do
get 'record_not_found'
end
include_examples 'respond_with_error', 404
it_behaves_like 'error response', 404
end
context 'with ActionController::InvalidAuthenticityToken' do
@ -141,7 +141,7 @@ RSpec.describe ApplicationController do
get 'invalid_authenticity_token'
end
include_examples 'respond_with_error', 422
it_behaves_like 'error response', 422
end
describe 'before_action :check_suspension' do
@ -186,7 +186,7 @@ RSpec.describe ApplicationController do
get 'route_forbidden'
end
include_examples 'respond_with_error', 403
it_behaves_like 'error response', 403
end
describe 'not_found' do
@ -201,7 +201,7 @@ RSpec.describe ApplicationController do
get 'route_not_found'
end
include_examples 'respond_with_error', 404
it_behaves_like 'error response', 404
end
describe 'gone' do
@ -216,7 +216,7 @@ RSpec.describe ApplicationController do
get 'route_gone'
end
include_examples 'respond_with_error', 410
it_behaves_like 'error response', 410
end
describe 'unprocessable_entity' do
@ -231,6 +231,6 @@ RSpec.describe ApplicationController do
get 'route_unprocessable_entity'
end
include_examples 'respond_with_error', 422
it_behaves_like 'error response', 422
end
end

View file

@ -5,7 +5,7 @@ require 'rails_helper'
RSpec.describe Auth::RegistrationsController do
render_views
shared_examples 'checks for enabled registrations' do |path|
shared_examples 'registration mode based responses' do |path|
context 'when in single user mode and open for registration' do
before do
Setting.registrations_mode = 'open'
@ -156,7 +156,7 @@ RSpec.describe Auth::RegistrationsController do
end
end
include_examples 'checks for enabled registrations', :new
it_behaves_like 'registration mode based responses', :new
end
describe 'POST #create' do
@ -542,7 +542,8 @@ RSpec.describe Auth::RegistrationsController do
it_behaves_like 'registration with time', 'only secondary time range is set', 0, 0, 9, 12, true
end
include_examples 'checks for enabled registrations', :create
it_behaves_like 'checks for enabled registrations', :create
it_behaves_like 'registration mode based responses', :create
end
describe 'DELETE #destroy' do

View file

@ -59,10 +59,10 @@ RSpec.describe Localized do
sign_in(user)
end
include_examples 'default locale'
it_behaves_like 'default locale'
end
context 'with a user who has not signed in' do
include_examples 'default locale'
it_behaves_like 'default locale'
end
end

View file

@ -35,7 +35,7 @@ RSpec.describe RelationshipsController do
describe 'PATCH #update' do
let(:alice) { Fabricate(:account, username: 'alice', domain: 'example.com') }
shared_examples 'redirects back to followers page' do
shared_examples 'general behavior for followed user' do
it 'redirects back to followers page' do
alice.follow!(user.account)
@ -49,7 +49,7 @@ RSpec.describe RelationshipsController do
context 'when select parameter is not provided' do
subject { patch :update }
include_examples 'redirects back to followers page'
it_behaves_like 'general behavior for followed user'
end
context 'when select parameter is provided' do
@ -83,7 +83,7 @@ RSpec.describe RelationshipsController do
end
end
include_examples 'redirects back to followers page'
it_behaves_like 'general behavior for followed user'
end
end
end

View file

@ -162,7 +162,7 @@ RSpec.describe Settings::ImportsController do
]
end
include_examples 'export failed rows', "Account address,Show boosts,Notify on new posts,Languages\nfoo@bar,true,false,\nuser@bar,false,true,\"fr, de\"\n"
it_behaves_like 'export failed rows', "Account address,Show boosts,Notify on new posts,Languages\nfoo@bar,true,false,\nuser@bar,false,true,\"fr, de\"\n"
end
context 'with blocks' do
@ -175,7 +175,7 @@ RSpec.describe Settings::ImportsController do
]
end
include_examples 'export failed rows', "foo@bar\nuser@bar\n"
it_behaves_like 'export failed rows', "foo@bar\nuser@bar\n"
end
context 'with mutes' do
@ -188,7 +188,7 @@ RSpec.describe Settings::ImportsController do
]
end
include_examples 'export failed rows', "Account address,Hide notifications\nfoo@bar,true\nuser@bar,false\n"
it_behaves_like 'export failed rows', "Account address,Hide notifications\nfoo@bar,true\nuser@bar,false\n"
end
context 'with domain blocks' do
@ -201,7 +201,7 @@ RSpec.describe Settings::ImportsController do
]
end
include_examples 'export failed rows', "bad.domain\nevil.domain\n"
it_behaves_like 'export failed rows', "bad.domain\nevil.domain\n"
end
context 'with bookmarks' do
@ -214,7 +214,7 @@ RSpec.describe Settings::ImportsController do
]
end
include_examples 'export failed rows', "https://foo.com/1\nhttps://foo.com/2\n"
it_behaves_like 'export failed rows', "https://foo.com/1\nhttps://foo.com/2\n"
end
context 'with lists' do
@ -227,7 +227,7 @@ RSpec.describe Settings::ImportsController do
]
end
include_examples 'export failed rows', "Amigos,user@example.com\nFrenemies,user@org.org\n"
it_behaves_like 'export failed rows', "Amigos,user@example.com\nFrenemies,user@org.org\n"
end
end

View file

@ -34,7 +34,7 @@ RSpec.describe Settings::TwoFactorAuthentication::ConfirmationsController do
get :new, session: { challenge_passed_at: Time.now.utc, new_otp_secret: 'thisisasecretforthespecofnewview' }
end
include_examples 'renders expected page'
it_behaves_like 'renders expected page'
end
it 'redirects if a new otp_secret has not been set in the session' do
@ -94,7 +94,7 @@ RSpec.describe Settings::TwoFactorAuthentication::ConfirmationsController do
.to include(I18n.t('otp_authentication.wrong_code'))
end
include_examples 'renders expected page'
it_behaves_like 'renders expected page'
end
private