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

Ruby 3.0 + Rails 6.1 shows DEPRECATION WARNING running rspec #294

Closed
xinyifly opened this issue Feb 25, 2021 · 7 comments
Closed

Ruby 3.0 + Rails 6.1 shows DEPRECATION WARNING running rspec #294

xinyifly opened this issue Feb 25, 2021 · 7 comments

Comments

@xinyifly
Copy link

xinyifly commented Feb 25, 2021

Output

DEPRECATION WARNING: Initialization autoloaded the constants ActionText::ContentHelper and ActionText::TagHelper.

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 ActionText::ContentHelper, 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 <top (required)> at /path/to/my/rails/project/config/environment.rb:5)

Versions

# ruby --version
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux]
# rails --version
Rails 6.1.3
# rspec --version
RSpec 3.10
  - rspec-core 3.10.1
  - rspec-expectations 3.10.1
  - rspec-mocks 3.10.2
  - rspec-rails 4.0.2
  - rspec-support 3.10.2

Notes

@Eric-Guo
Copy link
Owner

Can you try gem "wechat", git: "https://github.com/Eric-Guo/wechat", branch: :zeitwerk, I plan to only support Rails 6 and using zeitwerk mode in next release, but still under test.

@xinyifly
Copy link
Author

xinyifly commented Feb 26, 2021

@Eric-Guo
With gem 'wechat', git: 'https://github.com/Eric-Guo/wechat', branch: :zeitwerk , the DEPRECATION WARNING still exists.
With bin/spring stop , with config/initializers/wechat_redis_store.rb deleted, it exists as well.

@goofansu
Copy link
Contributor

goofansu commented Feb 27, 2021

See the same issue after upgrading Rails 6.1, but I'm not sure it caused by this gem.

@Eric-Guo
Copy link
Owner

I can not reproduce in Rails 6.1 without Rspec project, but I do see some change suggesting like Sorcery/sorcery#255

Eric-Guo added a commit that referenced this issue Feb 27, 2021
@Eric-Guo
Copy link
Owner

@goofansu @xinyifly Not sure if it's works, but seems should be a valid fix, so kindly test?

@xinyifly
Copy link
Author

xinyifly commented Feb 27, 2021

@Eric-Guo LOL, with latest zeitwerk branch, the DEPRECATION WARNING disappeared. Nice work, Thank you!

@Eric-Guo
Copy link
Owner

Eric-Guo commented Mar 3, 2021

Release 0.13.0 now in zeitwerk mode and support Rails 6.0+ only.

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

No branches or pull requests

3 participants