2015/09/24分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
Don't attempt to specify datetime precision unless supported
Active Recordのテストの修正です。
datetime precisionをサポートしていないDB(MySQL 5.6未満等)では、datetime型のカラムにprecision
を指定しないよう修正しています。
0 precision is not the same as no precision
activerecord/test/schema/schema.rb
の修正です。
先のコミット同様、datetime precisionをサポートしていないDB(MySQL 5.6未満等)では、datetime型のカラムにprecision
を指定しないよう修正しています。
Don't rely on subsecond precision being applied in tests
Active Recordのテストの修正です。
AR: take precision into count when assigning a value to timestamp attribute の対応のテストで、テスト中に秒の値が変わる事を期待しているのですが、
テストの実行タイミングによっては変わらない事もあるので、travel(1.second)
で明示的に秒が変わるよう修正しています。
Further remove reliance on subsecond precision in tests
activerecord/test/cases/timestamp_test.rb
の修正です。
先のコミット同様、テスト中に秒の値が変わる事を期待しているテストで、travel(1.second)
で明示的に秒が変わるよう修正しています。
Document Bearer prefix for Authorization header [ci skip]
actionpack/lib/action_controller/metal/http_authentication.rb
のdocの修正です。
Have Bearer be valid as well by phoet でAuthorization-header
にBearer
キーワードを指定した場合もauthenticateが動作するよう対応されたのですが、
docの方が更新されていなかったので、Bearer
も有効なprefixである旨説明を追加しています。
Removed Mocha from app generators tests
railties/test/generators/app_generator_test.rb
の修正です。
generatorsのテストで、mock処理にmocha
を使用していたのを、Rails内部のヘルパーメソッドを使用するよう修正しています。
don't mutate a response object after to_a
actionpack/test/dispatch/response_test.rb
の修正です。
Response#to_a
実行後、response objectの値を変更しないよう修正しています。
to_a
メソッドを呼び出す、という事はresponseが確定している状態になっている、という事なので、その後値を書き換えるのはテストとして良くないだろう、という事で修正したようです。
actionpack/test/dispatch/response_test.rb
の修正です。
複数のcookiesを扱うテストと、cookiesを削除するテストを一つのテストでまとめて行っていたのを、テストを分けています。
skipped assertion on datetime seconds precision as it is only valid for newer mysql versions
activerecord/test/cases/type/date_time_test.rb
の修正です。
datetime precisionをサポートしていないDB(MySQL 5.6未満等)で、datetime型のカラムにprecision
を指定したテストを行わないようskip処理を追加しています。
don't access the response object before a request was made
actionpack/test/controller/test_case_test.rb
の修正です。
ActionController::TestCase
クラスのテストで、リクエスト処理を行う前にresponse objectにアクセスしていたのを、先にリクエスト処理を行うよう修正しています。
Merge pull request #21218 from repinel/fix-as-callback-terminator https://github.com/rails/rails/commit/9c55ff564d21c178979cab126258123fa4b8b52a
Active Supportのcallback処理の修正です。
Active Record, Active Model, Active Model validations の callback処理で、callback処理中にfalse
を返してもcallback chainがhaltしないリグレッションがあったのを修正しています。
Fix ActiveRecord::Locking doc [ci skip]
activerecord/lib/active_record/locking/optimistic.rb
のdocの修正です。
Optimistic
moduleのdocのグラマーの修正を行っています。
Merge pull request #21737 from cllns/make-engine-paths-consistent
rails guideのGetting Started with Engines
の修正です。
Inside an Engine
の項、作成したengine製gemのインストールについて説明している箇所で、サンプルのパスがvendor
配下になっていたのですが、vendor
は既に存在しないパスなので、サンプルとしては不適切だろう、という事でパスを修正しています。
stop applying default headers in ActionDispatch::Response
Action Packの修正です。
ActionDispatch::Response#new
メソッドではdefault headersの設定を行わないよう変更しています。
default headersが設定されてないresponse objectを作りたい場合に困る為、との事です。default headersの設定がされたresponse objectが必要な場合、代わりにActionDispatch::Response.create
メソッドを使用して下さい、との事です。
test against controller responses
actionpack/test/controller/send_file_test.rb
の修正です。
send_data
メソッドのテストで、擬似的に作成したcontrollerを使用してresponseのチェックをしていたのを、responseオブジェクト経由で値のチェックをするよう修正しています。
stop constructing a request object in this setter
actionpack/lib/action_controller/metal/testing.rb
の修正です。
headers=
メソッドで、headerを設定する前にActionDispatch::Response
クラスのオブジェクトを生成していたのですが、現状、通常のテストフローであれば自動でresponse objectは生成されるようになっており、ここでresponse objectを生成する必要は無いため、処理を削除しています。
stop directly setting headers on the controller
actionpack/lib/action_controller/metal/testing.rb
、
actionpack/test/controller/send_file_test.rb
の修正です。
controllerから直接headersを設定する処理があったのを削除しています。
don't touch the response object until after we call get
actionpack/test/controller/live_stream_test.rb
の修正です。
request処理が行われる前にresponse objectを操作する処理があったのを削除しています。
type of response should not matter
actionpack/test/controller/live_stream_test.rb
の修正です。
controllerからresponseを設定するテストがあったのですが、controllerから直接response objectを変更するのは好ましく無い為、テスト自体を削除してます。
test framework allocates the controller for us
actionpack/test/controller/live_stream_test.rb
の修正です。
test_write_to_stream
メソッドから、不要なcontroller objectの生成処理を削除しています。
stop directly referencing the request and response objects
actionpack/test/controller/live_stream_test.rb
の修正です。
response / request オブジェクトを、テスト無いで直接参照している箇所があったのを、controller経由で値を参照するよう修正しています。
remove controller construction
actionpack/test/controller/live_stream_test.rb
の修正です。
各テストから、不要なcontroller objectの生成処理を削除しています。
call get
instead of controller.process
actionpack/test/controller/live_stream_test.rb
の修正です。
test_ignore_client_disconnect
で、requestを生成するのに、controllerのprocess
メソッドを使用していたのを、テスト用のget
メソッドを使用するよう修正しています。
Fix ActiveRecord instance_method_already_implemented
docs [ci skip]
activerecord/lib/active_record/attribute_methods.rb
のdocの修正です。
instance_method_already_implemented?
メソッドのdoc内のグラマーの修正を行っています。
activerecord/lib/active_record/railties/databases.rake
のdocの修正です。
db:test:prepare
のdescに、 pending migrationsをチェックする、と記載されていたのですが、Rails 4系からpending migrationsのチェックは行わなくなったので、説明を削除しています。
Merge pull request #21740 from cllns/add-jbuilder-notes
rails guideのAction View Overview
の修正です。
Jbuilder
gemについての説明を記載したJbuilder
セクションを追加しています。
Improve readability of docs by using code tag [ci skip]
activesupport/lib/active_support/core_ext/object/inclusion.rb
、
activesupport/lib/active_support/core_ext/object/try.rb
のdocの修正です。
各doc内のクラス名をcode tag(+
)で囲むよう修正しています。
Merge pull request #21697 from gdeglin/fix_returning_disabled_default_values_bug
activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
の修正です。
PostgresSQL adapterで extract_table_ref_from_insert_sql
でinto queryの判定用正規表現に誤りがあり、insert_returning
オプションにfalseを設定している場合に、エラーになってしまうバグがあったのを修正しています。
- sql[/into\s+([^\(]*).*values\s*\(/im] + sql[/into\s("[A-Za-z0-9_."\[\]\s]+"|[A-Za-z0-9_."\[\]]+)\s*/im]
partition tableを使用している場合に問題が起きてしまったようです。
Merge pull request #21550 from didacte/unscope-associations
activerecord/lib/active_record/associations/preloader/association.rb
の修正です。
through associationsをpreloadした場合に、unscopeメソッドが呼び出されないバグがあったのを修正しています。
PRより。
class Developer < ActiveRecord::Base default_scope -> { where(awesome: true) } end class Project < ActiveRecord::Base has_and_belongs_to_many :developers, -> { unscope(where: :awesome) }, end mediocre_dev = Developer.create(awesome: false) project = Project.create project.developers << mediocre_dev project.developers.reload.size # => 1 Project.where(id: project.id).includes(:developers).first.developers.size # => 0(本来は1になるべき)