なるようになるブログ

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

rails commit log流し読み(2019/01/30)

2019/01/30分のコミットです。

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

actionpack/CHANGELOG.md

actioncable/CHANGELOG.md

activesupport/CHANGELOG.md


activejob typo fixes.

activejob/lib/active_job/enqueuing.rbactivejob/test/cases/test_helper_test.rbの修正です。

enqueing -> enqueuingbllock -> blockにそれぞれ修正しています。


Update Sneakers to the latest version

Gemfile.lockの修正です。

sneakers gemのバージョンを更新しています。


Merge pull request #35081 from eileencodes/ec-driver-option-updated

Action Packの修正です。

ActionDispatch::SystemTestCase.driven_byにblock経由でbrowser capabilitiesを渡せるよう修正しています。

例。

class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
  driven_by :chrome, screen_size: [1024, 768] do |driver_option|
    driver_option.add_emulation(device: 'iPhone 6')
    driver_option.add_extension('path/to/chrome_extension.crx')
  end
end

Add ActionCable channel/connection load hooks

actioncable/lib/action_cable/channel/base.rbactioncable/lib/action_cable/connection/base.rbの修正です。

ActionCable::Connection::Base load時に実行するaction_cable_connection hook、及び、ActionCable::Channel::Base load時に実行するaction_cable_channel hookを追加しています。


Fix system testing failure

actionpack/lib/action_dispatch/system_testing/browser.rbの修正です。

Browser#headless_chrome_browser_optionsメソッドで、オプションを追加する際に使用するメソッド名を誤っていたのを修正しています。


Add HashWithIndifferentAccess#assoc

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

HashWithIndifferentAccessassocメソッドを追加しています。

Hash#assocと同じ挙動のメソッドですが、keyにString、Symbolどちらでも渡せるようになっています。


selenium-webdriver is not always required for system testing

actionpack/lib/action_dispatch/system_testing/browser.rbactionpack/test/dispatch/system_testing/screenshot_helper_test.rbの修正です。

action_dispatch/system_testing/browserselenium/webdriverをrequireしていたのを、requireしないよう修正しています。

system testingを使用するのにseleniumは必須ではない(seleniumを使わないというケースは普通にある)為。


Add require "selenium/webdriver" to all using DrivenBySeleniumWith* classes

actionpack/test/dispatch/system_testing/system_test_case_test.rbの修正です。

不足していたselenium/webdriverのrequireを追加しています。


Relax version locking of the selenium-webdriver

Gemfileの修正です。

ActionDispatch::SystemTestCase.driven_byにblock経由でbrowser capabilitiesを渡せるよう修正した、Merge pull request #35081 from eileencodes/ec-driver-option-updatedで、selenium-webdriver gemのバージョンを3.5系にロックしてしまっていたのを、3.13.0未満まで使用出来るようバージョン指定を修正しています。


Remove unused code

actionpack/lib/abstract_controller/caching/fragments.rbactiverecord/test/models/topic.rbの修正です。

使用してないメソッド、scope等を削除しています。


Fix case when we want a UrlConfig but the URL is nil

activerecord/lib/active_record/database_configurations.rbactiverecord/lib/active_record/database_configurations/url_config.rbの修正です。

configのurl keyの値がnilだった場合に、configの値がまるまるnilになってしまう、というバグがあったのを修正しています。

production: &production
  <<: *default
  url: <%= ENV['DATABASE_URL'] %>
  pool: <%= ENV.fetch('RAILS_MAX_THREADS', 40) %>

上記のような設定をdatabase.ymlに記載している、かつ、DATABASE_URLnilだった場合に、ActiveRecord::Base.configurations['production']nilになってしまっていたのを、正しくHash({"adapter"=>"postgresql", "pool"=>40, "timeout"=>5000, "encoding"=>"unicode", "url"=>nil})が取得出来るようになっています。