Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

any_loginのバージョンを上げてテスト実行時のdeprecation warningを消します #3435

Merged
merged 5 commits into from
Oct 26, 2021

Conversation

ima1zumi
Copy link
Member

以下のメッセージはany_login側の影響で出力されていましたが、v1.4.4で解消されました。
igorkasyanchuk/any_login@e649f24

any_loginのバージョンを上げることで、テスト実行時に出力されていたDEPRECATION WARNINGを出力しないようにします。

DEPRECATION WARNING: Initialization autoloaded the constants AnyLogin::ApplicationHelper and AnyLogin::ApplicationController.

Being able to do this is deprecated. Autoloading during initialization is going
to be an error condition in future versions of Rails.

Reloading does not reboot the application, and therefore code executed during
initialization does not run again. So, if you reload AnyLogin::ApplicationHelper, for example,
the expected changes won't be reflected in that stale Module object.

These autoloaded constants have been unloaded.

In order to autoload safely at boot time, please wrap your code in a reloader
callback this way:

    Rails.application.reloader.to_prepare do
      # Autoload classes and modules needed at boot time here.
    end

That block runs when the application boots, and every time there is a reload.
For historical reasons, it may run twice, so it has to be idempotent.

Check the "Autoloading and Reloading Constants" guide to learn more about how
Rails autoloads and reloads.
 (called from <main> at /Users/mi/ghq/github.com/fjordllc/bootcamp/config/environment.rb:5)

@ima1zumi ima1zumi requested a review from komagata October 21, 2021 12:26
@ima1zumi ima1zumi removed the request for review from komagata October 21, 2021 12:41
any_loginはconfig/initializers/any_login.rbに定義を書くので、production,testでもany_login.rbが読み込まれる。
その際any_loginが存在しないとエラーになるため、定義位置を戻す
開発時しか使わないため

AnyLogin.setup do |config|
config.enabled = false
end
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/igorkasyanchuk/any_login#production を見て、念の為書き足しました。

Copy link
Member

@komagata komagata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

おお〜、ついにany_loginバージョンアップしてたんですね、ありがとうございます!!

@komagata komagata merged commit e863f73 into main Oct 26, 2021
@komagata komagata deleted the fix-deprecation-warning branch October 26, 2021 05:46
@github-actions github-actions bot mentioned this pull request Oct 26, 2021
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants