You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We discovered that our runtime code in production had an expectation to be able to call symbolize_keys on a Ruby hash even though we had no dependency on activesupport. The tests flexed this code and passed. I was able to produce an example script that illustrates that factory_bot is injecting code into base classes which can mask production issues during test.
Reproduction Steps
begin{}.symbolize_keysrescueNoMethodError=>eputs"\e[31m------ WARNING ----- Hashes do not respond to symbolize_keys ---------\e[0m"endrequire'bundler/inline'gemfile(true)dosource'https://rubygems.org'group:development,:testdogem'factory_bot'endendrequire'factory_bot'puts"FactoryBot Version: #{FactoryBot::VERSION}"begin{}.symbolize_keysputs"\e[31m------ WARNING ----- Hashes now respond to symbolize_keys ---------"puts"This behavior is introduced by ActiveSupport\e[0m"rescueNoMethodError=>eputs" ------------ EXPECTED ---- Hashes still do not respond to symbolize_keys"end
Expected behavior
FactoryBot should not change behavior of classes it does not own.
Description
We discovered that our runtime code in production had an expectation to be able to call
symbolize_keys
on a Ruby hash even though we had no dependency on activesupport. The tests flexed this code and passed. I was able to produce an example script that illustrates that factory_bot is injecting code into base classes which can mask production issues during test.Reproduction Steps
Expected behavior
FactoryBot should not change behavior of classes it does not own.
Actual behavior
the
EXPECTED
line prints in the above script.System configuration
factory_bot version: 6.4.6
rails version: NA
ruby version: ruby 3.2.2 (2023-03-30 revision e51014f9c0) [arm64-darwin23]
The text was updated successfully, but these errors were encountered: