なるようになるブログ

読書感想文かrailsについてかrubyについてか

rails commit log流し読み(2017/11/09)

2017/11/09分のコミットです。

CHANGELOGにのったコミットは以下の通りです。

activesupport/CHANGELOG.md


Consolidate redundant if and unless with the same condition

activerecord/test/cases/transaction_isolation_test.rbの修正です。

同じ条件でunlessifがそれぞれ使われていたのを、if / elseにマージしています。


Mysql2Adapter should pass ConcurrentTransactionTest

activerecord/test/cases/transactions_test.rbの修正です。

ConcurrentTransactionTestがMysql2Adapterでも実行されるよう修正しています。


Remove redundant passing --skip-active-storage in test cases

railtiesのテストの修正です。

Do not run active_storage:install when bundle install is skippedの対応により不要になった、テスト内で--skip-active-storageを指定したのを削除しています。


Change output log about skipping instalation of Active Storage

railties/lib/rails/generators/app_base.rbの修正です。

Active Storageのインストール処理をスキップした場合(bundle installが実行されなかった場合)のメッセージ内のコマンド表示のエスケープに"'"を使用していたのを、"`"を使用するよう修正しています。


Run ConcurrentTransactionTest if supports_transaction_isolation?

activerecord/test/cases/transactions_test.rbの修正です。

ConcurrentTransactionTestを実行するかどうかの判定を、supports_transaction_isolation?メソッドを使用して行うよう修正しています。

Oracle enhanced adapterでも上記テストを実行出来るようにする為。


Correctly kill the server started with ujs test

actionview/Rakefileの修正です。

rails-ujsのテストで、テストで起動したserverを正しくkill出来ていなかったのを修正しています。


Merge pull request #31078 from aeroastro/feature/fix-typo

actionpack/lib/action_dispatch/http/filter_parameters.rbのdocの修正です。

ActionDispatch::HTTP::FilterParameters moduleのdocのグラマーの修正を行っています。


Merge pull request #31077 from gsamokovarov/assert-changes-nil

activesupport/lib/active_support/testing/assertions.rbの修正です。

assert_changesassert_no_changesメソッドでassertionにassert_equalassert_nilを使用していたのを、assertを使用するよう修正しています。

-        if before.nil?
-          assert_nil after, error
-        else
-          assert_equal before, after, error
-        end
+        assert before == after, error

Minitest 5.10からassert_equalのexpected引数にnilを指定するのがdeprecateになった為、それを避ける為に、resolve minitest 6 deprecation in assert_no_changesassert_nilを使用するようにしたのですが、他にも同様の問題が発生する可能性があるため、単純にassertを使うように変更したようです。


Should pass test_no_locks_no_wait not only on PostgreSQLAdapter and OracleAdapter

activerecord/test/cases/locking_test.rbの修正です。

test_no_locks_no_waitのテストをPostgreSQLAdapter、OracleAdapterでのみ実行されるようになっていたのを、すべてのadapterで実行されるよう修正しています。


Do not show credentials in generators help

railties/lib/rails/generators.rbの修正です。

rails generatorsのhelpにcredentialsが表示されないよう修正しています。

credentials generatorはcredentialsコマンド(credentials:edit)経由で実行される事を想定しており、generatorを直接実行する事は無い為。


Merge pull request #31081 from rails/allow-include-time-with-zone-range

Active Supportの修正です。

Range#include?ActiveSupport::TimeWithZoneインスタンスを指定出来るよう修正しています。

# before
(1.hour.ago..1.hour.from_now).include?(Time.current)
# => TypeError: can't iterate from ActiveSupport::TimeWithZone

# after
(1.hour.ago..1.hour.from_now).include?(Time.current)
# => true

Ruby 2.3から、Rangeの始点/終点ににTimeオブジェクトを指定出来るようになっており、それならばTimeWithZoneも指定出来ても良いだろう、という事で対応されたようです。

参考:Bug #11113: Time ranges cannot be used in case statements in 1.9+ but they could in 1.8.7