2015/07/09分のコミットです。
CHANGELOGへの追加はありませんでした。
allocate new responses rather than recycling them
actionpack/lib/action_controller/test_case.rb
の修正です。
テストでresponseオブジェクトを生成するのに、独自に定義したrecycle!
メソッドを経由してオブジェクトを生成していたのを、普通にnew
メソッド経由でオブジェクトを生成するように修正しています。
remove useless new
implementation
actionpack/lib/action_dispatch/testing/test_request.rb
の修正です。
先のコミットにより不要になったTestRequest.new
メソッドを削除しています。
Add method call assertions for internal use.
activesupport/lib/active_support/testing/method_call_assertions.rb
の修正です。
指定したメソッドが呼ばれた/呼ばれないことを確認する為のテスト用のassertionとして、assert_called
、assert_not_called
メソッドを追加しています。
mock = Minitest::Mock.new mock.expect(:call, nil, []) original.stub(:delete, mock) do original.except(:a) end assert_equal "expected call() => nil, got []", assert_raises(MockExpectationError) { mock.verify }.message
上記のような処理をメソッドにまとめた感じになります。Railsが内部で使うようで、通常ユーザが使うようではないようです。
let the superclass build the request and response
ActionPackの修正です。
テスト毎にrequest/response
オブジェクトを生成していたのを、親クラスの前処理で作成して、それを使いまわすよう修正しています。
Add Deserialization section on guides at ActiveJob Exception
rails guideのActive Job Basics
の修正です。
Deserialization
の項を追加して、ジョブ実行前にジョブに渡されたrecordが削除された場合に、ActiveJob::DeserializationError
が発生する旨説明を追加しています。
pass the session and env in to the test request
actionpack/lib/action_controller/test_case.rb
の修正です。
TestCase#build_request
メソッドでテスト用のリクエストを作成する際、セッション情報も渡すよう修正しています。
actionpack/test/controller/url_rewriter_test.rb
の修正です。
不要なbuild_request
メソッドの呼び出しを削除しています。
pass the starting env and session to build_request
actionpack/lib/action_controller/test_case.rb
の修正です。
TestCase#build_request
メソッドの引数にenv、sessionを追加しています。
actionpack/lib/action_dispatch/testing/test_request.rb
の修正です。
TestRequest
クラスのコンストラクタで、 任意の引数だったenv
を必須引数に修正しています。
add a new constructor for allocating test requests
actionpack/lib/action_controller/test_case.rb
の修正です。
TestCase
クラスに、オブジェクト生成用の新規メソッド(create
メソッド)を追加しています。
pass the variant as a parameter to more reflect real world apps
actionpack/test/controller/caching_test.rb
の修正です。
variantsのテストで、@requestオブジェクトの値を操作してvariant
を設定していたのを、get
メソッドのパラメータに指定するよう修正しています。実際使われる場合は、当然パラメータとして送信されてくる情報なので、より実際のケースに近い形でテストした方が良いだろう、という事で修正したようです。
request objects are no longer recycled
actionpack/lib/action_controller/test_case.rb
の修正です。
TestResponse#process
メソッド実行時、もともと保持していたrequest オブジェクトを再利用するのではなく、必要な情報のみ引き継いで、随時オブジェクトを再作成するよう修正しています。
assign the cookie hash on request allocation
actionpack/lib/action_controller/test_case.rb
の修正です。
request オブジェクト生成時に、cookie hashを設定するよう修正しています。
use new constructor. (Oops! :bomb:)
actionview/lib/action_view/test_case.rb
、
actionview/test/actionpack/controller/view_paths_test.rb
の修正です。
TestRequest
クラスのオブジェクトを生成するのに、新規に追加したcreate
メソッドを使用するよう修正しています。
build and assign parameters rather than rely on mutations
actionpack/lib/action_controller/test_case.rb
、
actionpack/test/controller/test_case_test.rb
の修正です。
action_dispatch.request.query_parameters
、action_dispatch.request.request_parameters
をrequestオブジェクトにメソッド経由で設定出来るよう対応しています。
Allow pluralize
helper to take a locale.
actionview/lib/action_view/helpers/text_helper.rb
の修正です。
pluralize
メソッドにlocaleを渡せるよう対応しています。
pluralize(2, 'Person', locale: :de) # => 2 Personen
use JSON to communicate between the controller and the tests
actionpack/test/controller/test_case_test.rb
の修正です。
controllerとテストのデータ連携にJSONを使用するよう修正しています。