thoughtbot / factory_bot

A library for setting up Ruby objects as test data.
https://thoughtbot.com
MIT License
7.89k stars 2.6k forks source link

Warnings are displayed when factory bot is used with Ruby 3.3.0 #1641

Open robinborst95 opened 2 months ago

robinborst95 commented 2 months ago

Description

Running code that uses the factory bot gem with Ruby 3.3.0 causes the following warnings to be shown:

warning: /opt/hostedtoolcache/Ruby/3.3.1/x64/lib/ruby/3.3.0/observer.rb was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.4.0. Add observer to your Gemfile or gemspec. Also contact author of factory_bot-6.2.1 to add observer into its gemspec.

This is a deprecation warning that has been added to Ruby 3.3.0 and which will cause factory bot to fail if run with Ruby 3.4. See https://rubyreferences.github.io/rubychanges/3.3.html#gems-that-are-warned-to-become-bundled-in-the-next-version

Reproduction Steps

Run any code that uses this gem with Ruby 3.3.0 and you'll get this warning.

Expected behavior

This gem defines observer as a dependency in its gemspec.

Actual behavior

observer is not yet defined in its gemspec.

System configuration

factory_bot version: 6.2.1 ruby version: 3.3.0

hamilton-keisuke commented 3 weeks ago

I think this warning has been resolved in 6.4.4 or later.

cf.