2017/02/02分のコミットです。
CHANGELOGへの追加はありませんでした。
explicitly require listen
in EventedFileUpdateCheckerTest
(#27867)
activesupport/test/evented_file_update_checker_test.rb
の修正です。
EventedFileUpdateChecker
のテストの前処理でlisten
をrequireするよう修正しています。後処理でlisten
のメソッドを使用している為。
Virtual/generated column support for MySQL 5.7.5+ and MariaDB 5.2.0+
Active Recordの修正です。
migrationにMySQLのgenerated columns、及び、MariaDBのvirtual columnsを使用出来るよう対応しています。virtual
メソッドを使用する事で定義出来るようになっています。
CHANGELOGより。
create_table :generated_columns do |t| t.string :name t.virtual :upper_name, type: :string, as: "UPPER(name)" t.virtual :name_length, type: :integer, as: "LENGTH(name)", stored: true t.index :name_length # May be indexed, too! end
stored
オプションを指定すると、実データが保持される(STORED
キーワードが指定された状態)ようになります。
参考:
- MySQL :: MySQL 5.7 Reference Manual :: 14.1.18.7 CREATE TABLE and Generated Columns
- Virtual (Computed) Columns - MariaDB Knowledge Base
- JSON型にindexも!MySQL 5.7のGenerated Columnsの可能性について探る - UUUM攻殻機動隊
bin/test for Active Job and Action Cable tests
actioncable/bin/test
、
activejob/bin/test
の修正です。
Action Cable、Active Jobのテストにtest runnerを使用する為のbin/test
スクリプトを追加しています。
actionview/test/actionpack/controller/render_test.rb
、
actionview/test/lib/controller/fake_models.rb
の修正です。
renderのテストで使用するテスト用のmodelを、テストファイルに直接定義していたのを、他と合わせてmodel定義用のファイル(fake_models.rb
)で定義するよう修正しています。
module Blog; class Post appears twice in AV tests
actionview/test/activerecord/polymorphic_routes_test.rb
の修正です。
polymorphic routesのテストで使用するテスト用のmodelのmodule名をBlog
-> Weblog
に修正しています。同名のmoduleが別の箇所で使われており、名前がバッティングするのを避ける為にこちらを変更したようです。
actionpack/test/journey/path/pattern_test.rb
の修正です。
path patternのテストを動的に定義する際に、テスト名をRegexp.escape
でescapeするよう修正しています。
- define_method(:"test_to_regexp_#{path}") do + define_method(:"test_to_regexp_#{Regexp.escape(path)}") do
pathには正規表現が含まれおり、escapeせずに値を使用するとRegexpError
が発生してしまう事がある為、との事です。再現しなかった…。
Fix test failures only seen when executed via bin/test
actionview/test/template/render_test.rb
の修正です。
sub_template_message
メソッドのテストで、sub_template_message
の戻り値からRails.root
の値を消すよう修正しています。
- assert_equal "Trace of template inclusion: #{File.expand_path("#{FIXTURE_LOAD_PATH}/test/sub_template_raise.html.erb")}", e.sub_template_message + assert_equal "Trace of template inclusion: #{File.expand_path("#{FIXTURE_LOAD_PATH}/test/sub_template_raise.html.erb").sub("#{Rails.root}/", "")}", e.sub_template_message
sub_template_message
の戻り値はRails.root
により変わるようになっています。また、bin/test
でテストを実行するとRails.root
が定義された状態になります。そのため、bin/test
でテストを実行した場合とrakeでテストを実行した場合とで結果が変わる事になり、その差異を無くす為に、Rails.root
の値を消すよう修正したようです。
が、rake経由でテストを実行した場合、そもそもRails.root
が定義されておらず、NoMethodError
でエラーになってしまう為、後ほどassert_match
を使用するよう修正しています。
Fix CI failure caused by aa647b46cce55ec12f5895e403c0d1b85502c8e0
actionview/test/template/render_test.rb
の修正です。
さきほどのコミットによりCI上でテストが壊れるようになってしまった為、Rails.root
を消すのではなく、正規表現で確認するよう修正しています。
- assert_equal "Trace of template inclusion: #{File.expand_path("#{FIXTURE_LOAD_PATH}/test/sub_template_raise.html.erb").sub("#{Rails.root}/", "")}", e.sub_template_message + assert_match %r{Trace of template inclusion: .*test/sub_template_raise.html.erb}, e.sub_template_message