2025/03/08分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
- Generate session controller tests when running the authentication generator.
- Introduce
bin/ci
for running your tests, style checks, and security audits locally or in the cloud.
Generate session controller tests for auth generator (#53726)
railties/lib/rails/generators/test_unit/authentication/authentication_generator.rb
、
railties/lib/rails/generators/test_unit/authentication/templates/test/controllers/sessions_controller_test.rb
の修正です。
authentication
generator実行時に、session controllerのテスト用を生成するよう修正しています。
Update bundler-audit.tt to reference config/bundler-audit.yml (extension is .yml
instead of .yaml
)
railties/lib/rails/generators/rails/app/templates/bin/bundler-audit.tt
の修正です。
bin/bundler-audit
binstubで参照する設定ファイルの拡張子が誤っていたのを修正しています。
Handle libpq db version 0 as connection failure in PostgreSQLAdapter
activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
の修正です。
PostgreSQL adapteでserverのバージョンを取得した際に、バージョンの値が0の場合、エラーをraiseするよう修正しています。connectionが正しく接続出来ていなかったなど、値が正しく取得出来なかった場合に、libpqが0を返す事がある為。
Merge pull request #54655 from viralpraxis/raise-actionpack-double-render-error-on-head-after-render
actionpack/lib/action_controller/metal/head.rb
の修正です。
response bodyが既に設定されいてる場合(e.g. render
が既に実行済み)に、head
メソッドが実行された場合に、AbstractController::DoubleRenderError
をraiseするよう修正しています。
Merge pull request #54702 from fatkodima/fix-action_mailer-default_options-docs
actionmailer/lib/action_mailer/base.rb
のdocの修正です。
ActionMailer::Base.default
メソッドのdocにあるdefault optionsを設定するexampleが実際には動作しないコードになっていたのを修正しています。
Structured CI with bin/ci (#54693)
Active Support、railtiesの修正です。
テスト、スタイルチェック、security auditなど、CIで実行している処理を実行する為のbin/ci
コマンドを追加しています。CIで実行している内容をconfigファイル(config/ci.rb
)で設定出来るようになっており、ローカルや任意のクラウド等で、CIで行っているとの同じ処理を実行出来るようにする為、との事です。以下configファイルの例。
CI.run do step "Setup", "bin/setup --skip-server" step "Style: Ruby", "bin/rubocop" step "Security: Brakeman code analysis", "bin/brakeman", "--quiet", "--no-pager", "--exit-on-warn", "--exit-on-error" step "Security: Importmap vulnerability audit", "bin/importmap", "audit" step "Tests: Rails", "bin/rails", "test", "test:system" step "Tests: Seeds", "env RAILS_ENV=test bin/rails db:seed:replant" if success? step "Signoff: All systems go. Ready for merge and deploy.", "gh signoff" else failure "Signoff: Failed. Do not merge or deploy.", "Fix the issues and try again." end end
basecamp/gh-signoffを合わせて使う事で、テストが成功した場合、自動でPRをテストパス状態に変更出来るようになっています。今後はGitHub Actionsもこれを使うよう置き換える予定がある、との事です。
Don't rely on which
for testing ContinuousIntegration
activesupport/test/continuous_integration_test.rb
の修正です。
ContinuousIntegration
のテストでwhich
コマンドを使用しないよう修正しています。which
コマンドは使えない環境がある為。
Get rid of useless :itself
proc
activesupport/lib/active_support/continuous_integration.rb
の修正です。
ContinuousIntegration#success?メソッドから不要な
itself`の呼び出しを削除しています。
activesupport/lib/active_support/continuous_integration.rb
の修正です。
ContinuousIntegration#new
メソッドから使用していないblock変数を削除しています。
railties/lib/rails/generators/rails/app/templates/config/bundler-audit.yml.tt
の修正です。
bundle-audit
のexampleファイルに、igonre
を指定した場合の例を含むよう修正しています。