Diff of the two buildlogs: -- --- b1/build.log 2025-03-22 06:24:49.313707088 +0000 +++ b2/build.log 2025-03-22 06:26:23.817460486 +0000 @@ -1,6 +1,6 @@ I: pbuilder: network access will be disabled during build -I: Current time: Fri Mar 21 18:23:07 -12 2025 -I: pbuilder-time-stamp: 1742624587 +I: Current time: Sat Mar 22 20:24:58 +14 2025 +I: pbuilder-time-stamp: 1742624698 I: Building the build Environment I: extracting base tarball [/var/cache/pbuilder/unstable-reproducible-base.tgz] I: copying local configuration @@ -25,52 +25,84 @@ dpkg-source: info: applying 0004-Fix-failing-tests-with-rails-5.2.patch I: Not using root during the build. I: Installing the build-deps -I: user script /srv/workspace/pbuilder/27380/tmp/hooks/D02_print_environment starting +I: user script /srv/workspace/pbuilder/25724/tmp/hooks/D01_modify_environment starting +debug: Running on virt64z. +I: Changing host+domainname to test build reproducibility +I: Adding a custom variable just for the fun of it... +I: Changing /bin/sh to bash +'/bin/sh' -> '/bin/bash' +lrwxrwxrwx 1 root root 9 Mar 22 06:25 /bin/sh -> /bin/bash +I: Setting pbuilder2's login shell to /bin/bash +I: Setting pbuilder2's GECOS to second user,second room,second work-phone,second home-phone,second other +I: user script /srv/workspace/pbuilder/25724/tmp/hooks/D01_modify_environment finished +I: user script /srv/workspace/pbuilder/25724/tmp/hooks/D02_print_environment starting I: set - BUILDDIR='/build/reproducible-path' - BUILDUSERGECOS='first user,first room,first work-phone,first home-phone,first other' - BUILDUSERNAME='pbuilder1' - BUILD_ARCH='armhf' - DEBIAN_FRONTEND='noninteractive' - DEB_BUILD_OPTIONS='buildinfo=+all reproducible=+all parallel=3 ' - DISTRIBUTION='unstable' - HOME='/root' - HOST_ARCH='armhf' + BASH=/bin/sh + BASHOPTS=checkwinsize:cmdhist:complete_fullquote:extquote:force_fignore:globasciiranges:globskipdots:hostcomplete:interactive_comments:patsub_replacement:progcomp:promptvars:sourcepath + BASH_ALIASES=() + BASH_ARGC=() + BASH_ARGV=() + BASH_CMDS=() + BASH_LINENO=([0]="12" [1]="0") + BASH_LOADABLES_PATH=/usr/local/lib/bash:/usr/lib/bash:/opt/local/lib/bash:/usr/pkg/lib/bash:/opt/pkg/lib/bash:. + BASH_SOURCE=([0]="/tmp/hooks/D02_print_environment" [1]="/tmp/hooks/D02_print_environment") + BASH_VERSINFO=([0]="5" [1]="2" [2]="37" [3]="1" [4]="release" [5]="arm-unknown-linux-gnueabihf") + BASH_VERSION='5.2.37(1)-release' + BUILDDIR=/build/reproducible-path + BUILDUSERGECOS='second user,second room,second work-phone,second home-phone,second other' + BUILDUSERNAME=pbuilder2 + BUILD_ARCH=armhf + DEBIAN_FRONTEND=noninteractive + DEB_BUILD_OPTIONS='buildinfo=+all reproducible=+all parallel=4 ' + DIRSTACK=() + DISTRIBUTION=unstable + EUID=0 + FUNCNAME=([0]="Echo" [1]="main") + GROUPS=() + HOME=/root + HOSTNAME=i-capture-the-hostname + HOSTTYPE=arm + HOST_ARCH=armhf IFS=' ' - INVOCATION_ID='e0fddf63f7e945679240a786b8dd3f2f' - LANG='C' - LANGUAGE='en_US:en' - LC_ALL='C' - MAIL='/var/mail/root' - OPTIND='1' - PATH='/usr/sbin:/usr/bin:/sbin:/bin:/usr/games' - PBCURRENTCOMMANDLINEOPERATION='build' - PBUILDER_OPERATION='build' - PBUILDER_PKGDATADIR='/usr/share/pbuilder' - PBUILDER_PKGLIBDIR='/usr/lib/pbuilder' - PBUILDER_SYSCONFDIR='/etc' - PPID='27380' - PS1='# ' - PS2='> ' + INVOCATION_ID=eb2d503557c44ff4bc8f5a4f790bff06 + LANG=C + LANGUAGE=it_CH:it + LC_ALL=C + MACHTYPE=arm-unknown-linux-gnueabihf + MAIL=/var/mail/root + OPTERR=1 + OPTIND=1 + OSTYPE=linux-gnueabihf + PATH=/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/i/capture/the/path + PBCURRENTCOMMANDLINEOPERATION=build + PBUILDER_OPERATION=build + PBUILDER_PKGDATADIR=/usr/share/pbuilder + PBUILDER_PKGLIBDIR=/usr/lib/pbuilder + PBUILDER_SYSCONFDIR=/etc + PIPESTATUS=([0]="0") + POSIXLY_CORRECT=y + PPID=25724 PS4='+ ' - PWD='/' - SHELL='/bin/bash' - SHLVL='2' - SUDO_COMMAND='/usr/bin/timeout -k 18.1h 18h /usr/bin/ionice -c 3 /usr/bin/nice /usr/sbin/pbuilder --build --configfile /srv/reproducible-results/rbuild-debian/r-b-build.qAp54qSS/pbuilderrc_00rF --distribution unstable --hookdir /etc/pbuilder/first-build-hooks --debbuildopts -b --basetgz /var/cache/pbuilder/unstable-reproducible-base.tgz --buildresult /srv/reproducible-results/rbuild-debian/r-b-build.qAp54qSS/b1 --logfile b1/build.log ruby-factory-bot_6.5.1-1.dsc' - SUDO_GID='113' - SUDO_UID='107' - SUDO_USER='jenkins' - TERM='unknown' - TZ='/usr/share/zoneinfo/Etc/GMT+12' - USER='root' - _='/usr/bin/systemd-run' - http_proxy='http://10.0.0.15:3142/' + PWD=/ + SHELL=/bin/bash + SHELLOPTS=braceexpand:errexit:hashall:interactive-comments:posix + SHLVL=3 + SUDO_COMMAND='/usr/bin/timeout -k 24.1h 24h /usr/bin/ionice -c 3 /usr/bin/nice -n 11 /usr/bin/unshare --uts -- /usr/sbin/pbuilder --build --configfile /srv/reproducible-results/rbuild-debian/r-b-build.qAp54qSS/pbuilderrc_ntBB --distribution unstable --hookdir /etc/pbuilder/rebuild-hooks --debbuildopts -b --basetgz /var/cache/pbuilder/unstable-reproducible-base.tgz --buildresult /srv/reproducible-results/rbuild-debian/r-b-build.qAp54qSS/b2 --logfile b2/build.log ruby-factory-bot_6.5.1-1.dsc' + SUDO_GID=110 + SUDO_UID=103 + SUDO_USER=jenkins + TERM=unknown + TZ=/usr/share/zoneinfo/Etc/GMT-14 + UID=0 + USER=root + _='I: set' + http_proxy=http://10.0.0.15:3142/ I: uname -a - Linux virt32a 6.1.0-32-armmp-lpae #1 SMP Debian 6.1.129-1 (2025-03-06) armv7l GNU/Linux + Linux i-capture-the-hostname 6.1.0-32-arm64 #1 SMP Debian 6.1.129-1 (2025-03-06) aarch64 GNU/Linux I: ls -l /bin lrwxrwxrwx 1 root root 7 Mar 4 11:20 /bin -> usr/bin -I: user script /srv/workspace/pbuilder/27380/tmp/hooks/D02_print_environment finished +I: user script /srv/workspace/pbuilder/25724/tmp/hooks/D02_print_environment finished -> Attempting to satisfy build-dependencies -> Creating pbuilder-satisfydepends-dummy package Package: pbuilder-satisfydepends-dummy @@ -271,7 +303,7 @@ Get: 147 http://deb.debian.org/debian unstable/main armhf ruby-rspec-its all 1.3.0-1 [6864 B] Get: 148 http://deb.debian.org/debian unstable/main armhf ruby-sqlite3 armhf 1.7.3-1 [47.9 kB] Get: 149 http://deb.debian.org/debian unstable/main armhf ruby-timecop all 0.9.10-1.1 [12.2 kB] -Fetched 47.9 MB in 1s (58.3 MB/s) +Fetched 47.9 MB in 4s (11.2 MB/s) Preconfiguring packages ... Selecting previously unselected package libpython3.13-minimal:armhf. (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 19532 files and directories currently installed.) @@ -765,8 +797,8 @@ Setting up tzdata (2025a-2) ... Current default time zone: 'Etc/UTC' -Local time is now: Sat Mar 22 06:23:56 UTC 2025. -Universal Time is now: Sat Mar 22 06:23:56 UTC 2025. +Local time is now: Sat Mar 22 06:25:43 UTC 2025. +Universal Time is now: Sat Mar 22 06:25:43 UTC 2025. Run 'dpkg-reconfigure tzdata' if you wish to change it. Setting up ruby-minitest (5.25.4-2) ... @@ -902,7 +934,11 @@ Building tag database... -> Finished parsing the build-deps I: Building the package -I: Running cd /build/reproducible-path/ruby-factory-bot-6.5.1/ && env PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/games" HOME="/nonexistent/first-build" dpkg-buildpackage -us -uc -b && env PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/games" HOME="/nonexistent/first-build" dpkg-genchanges -S > ../ruby-factory-bot_6.5.1-1_source.changes +I: user script /srv/workspace/pbuilder/25724/tmp/hooks/A99_set_merged_usr starting +Not re-configuring usrmerge for unstable +I: user script /srv/workspace/pbuilder/25724/tmp/hooks/A99_set_merged_usr finished +hostname: Name or service not known +I: Running cd /build/reproducible-path/ruby-factory-bot-6.5.1/ && env PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/i/capture/the/path" HOME="/nonexistent/second-build" dpkg-buildpackage -us -uc -b && env PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/i/capture/the/path" HOME="/nonexistent/second-build" dpkg-genchanges -S > ../ruby-factory-bot_6.5.1-1_source.changes dpkg-buildpackage: info: source package ruby-factory-bot dpkg-buildpackage: info: source version 6.5.1-1 dpkg-buildpackage: info: source distribution unstable @@ -935,7 +971,7 @@ │ ruby-factory-bot: Installing files and building extensions for ruby3.3 │ └──────────────────────────────────────────────────────────────────────────────┘ -/usr/bin/ruby3.3 -S gem build --config-file /dev/null --verbose /tmp/d20250321-32396-dehkee/gemspec +/usr/bin/ruby3.3 -S gem build --config-file /dev/null --verbose /tmp/d20250322-30914-2u0p91/gemspec WARNING: open-ended dependency on activesupport (>= 6.1.0) is not recommended if activesupport is semantically versioned, use: add_runtime_dependency "activesupport", "~> 6.1", ">= 6.1.0" @@ -966,7 +1002,7 @@ Name: factory_bot Version: 6.5.1 File: factory_bot-6.5.1.gem -/usr/bin/ruby3.3 -S gem install --config-file /dev/null --verbose --local --verbose --no-document --ignore-dependencies --install-dir debian/ruby-factory-bot/usr/share/rubygems-integration/all /tmp/d20250321-32396-dehkee/factory_bot-6.5.1.gem +/usr/bin/ruby3.3 -S gem install --config-file /dev/null --verbose --local --verbose --no-document --ignore-dependencies --install-dir debian/ruby-factory-bot/usr/share/rubygems-integration/all /tmp/d20250322-30914-2u0p91/factory_bot-6.5.1.gem /build/reproducible-path/ruby-factory-bot-6.5.1/debian/ruby-factory-bot/usr/share/rubygems-integration/all/gems/factory_bot-6.5.1/lib/factory_bot.rb /build/reproducible-path/ruby-factory-bot-6.5.1/debian/ruby-factory-bot/usr/share/rubygems-integration/all/gems/factory_bot-6.5.1/lib/factory_bot/aliases.rb /build/reproducible-path/ruby-factory-bot-6.5.1/debian/ruby-factory-bot/usr/share/rubygems-integration/all/gems/factory_bot-6.5.1/lib/factory_bot/attribute.rb @@ -1052,711 +1088,776 @@ mv Gemfile.lock ./.gem2deb.Gemfile.lock /usr/bin/ruby3.3 -I/usr/share/rubygems-integration/all/gems/rspec-support-3.13.1/lib:/usr/share/rubygems-integration/all/gems/rspec-core-3.13.0/lib /usr/share/rubygems-integration/all/gems/rspec-core-3.13.0/exe/rspec --pattern spec/\{\*_spec.rb,factory_bot/\*\*/\*_spec.rb\} --format documentation -Randomized with seed 35672 +Randomized with seed 6886 -FactoryBot aliases - for a foreign key should include both the suffixed and un-suffixed variants - for an attribute which starts with an underscore should not include a non-underscored version - for an attribute should include the original attribute and a version suffixed with '_id' +FactoryBot::Declaration::Association + #== + when comparing against another type of object + the objects are NOT equal + when the attributes are equal + the objects are equal + when the options are different + the objects are NOT equal + when the names are different + the objects are NOT equal -FactoryBot::DefinitionProxy adding callbacks - adding both a :before_stub and a :before_create callback succeeds - adding both an :after_stub and a :before_create callback succeeds - adding an :after_create callback succeeds - adding an :after_build callback succeeds - adding an :after_stub callback succeeds - adding both an :after_stub and an :after_create callback succeeds +FactoryBot::StrategyCalculator + returns the strategy found when instantiated with a symbol + finds the strategy by name when instantiated with a symbol + returns the class passed when it is instantiated with a class -FactoryBot::Factory with a name ending in s - has a build class - has a name +FactoryBot::Factory human names + parses names with aliases + parses human names with underscores + parses human names with aliases + parses names with underscores + parses names without underscores + parses human names without underscores + parses human names with big letters + parses names with big letters -FactoryBot::Callback - converts strings to symbols - runs its block with one parameter +FactoryBot::Definition has a name - runs its block with no parameters - runs its block with two parameters + doesn't expose a separate create strategy when none is specified + adds only unique traits + maintains a list of traits + maintains a list of enum fields + maintains a list of callbacks + delegates :declare_attribute to declarations + has an overridable declaration list + exposes a non-default create strategy when one is provided by the user + creates a new attribute list with the name passed when given a name -FactoryBot::Attribute::Dynamic - with a block referencing an attribute on the attribute - evaluates the attribute from the attribute - with a block returning a sequence - raises a sequence abuse error - name - is expected to eq :first_name - with a block returning a static value - returns the value when executing the proc - with a block returning its block-level variable - returns self when executing the proc +FactoryBot::Sequence + a custom sequence and scope increments within the correct scope when incrementing + a custom sequence and scope increments within the correct scope + a custom scope increments within the correct scope after rewinding + a custom sequence + behaves like a sequence + has a next value equal to the 1st value after rewinding + has a next value equal to the 2nd value after being incremented + has a next value equal to its first value + a basic sequence + behaves like a sequence + has a next value equal to the 2nd value after being incremented + has a next value equal to its first value + has a next value equal to the 1st value after rewinding + names + is expected to eq [:test] + name + is expected to eq :test + iterating over items in an enumerator + navigates to the next items until no items remain + behaves like a sequence + has a next value equal to the 2nd value after being incremented + has a next value equal to the 1st value after rewinding + has a next value equal to its first value + a custom sequence without a block + behaves like a sequence + has a next value equal to its first value + has a next value equal to the 1st value after rewinding + has a next value equal to the 2nd value after being incremented + a sequence with custom value and aliases + has the expected names as its names + behaves like a sequence + has a next value equal to the 1st value after rewinding + has a next value equal to the 2nd value after being incremented + has a next value equal to its first value + a basic sequence without a block + behaves like a sequence + has a next value equal to the 2nd value after being incremented + has a next value equal to the 1st value after rewinding + has a next value equal to its first value + a sequence with aliases using default value + has the expected names as its names + behaves like a sequence + has a next value equal to the 2nd value after being incremented + has a next value equal to its first value + has a next value equal to the 1st value after rewinding -FactoryBot::Factory when defined with a custom class name - has a build_class equal to its custom class name +FactoryBot::Factory running a factory + calls the block and returns the result + creates the right strategy using the build class when running + returns the result from the strategy when running -FactoryBot::DefinitionProxy#sequence - creates a new sequence starting at 1 - creates a new sequence with a block - creates a new sequence with an overridden starting value +FactoryBot::DefinitionProxy#initialize_with + defines the constructor on the definition -FactoryBot::Factory with a string for a name +FactoryBot::NullObject + responds to the given methods + does not respond to other methods + +FactoryBot::AttributeList#define_attribute + returns the attribute + maintains a list of attributes + raises if an attribute has already been defined + +FactoryBot::Factory when defined with a class instead of a name + has a build_class has a name - sets build_class correctly with a class with an underscore + +FactoryBot::Attribute::Sequence + assigns the next value in the sequence + name + is expected to eq :first_name FactoryBot::Factory for namespaced class - sets build_class correctly with a namespaced class with Namespace::Class syntax sets build_class correctly with a namespaced class with namespace/class syntax + sets build_class correctly with a namespaced class with Namespace::Class syntax -FactoryBot::Definition - maintains a list of enum fields - doesn't expose a separate create strategy when none is specified - has a name - adds only unique traits - has an overridable declaration list - maintains a list of traits - maintains a list of callbacks - exposes a non-default create strategy when one is provided by the user - delegates :declare_attribute to declarations - creates a new attribute list with the name passed when given a name +FactoryBot::DefinitionProxy#method_missing + declares an implicit declaration when called without args or a block + declares an association when called with a ':factory' key + raises a NoMethodError when called with a static-attribute-like argument + declares a dynamic attribute when called with a block -FactoryBot::AttributeList#define_attribute - raises if an attribute has already been defined - maintains a list of attributes - returns the attribute +FactoryBot + finds a registered strategy + .use_parent_strategy + is true by default -FactoryBot::Declaration::Association +FactoryBot::NullFactory + delegates callbacks to its definition + delegates defined traits to its definition + delegates attributes to its definition + has a nil value for its class_name attribute + has a nil value for its compile attribute + has FactoryBot::Evaluator as its evaluator class + has an instance of FactoryBot::AttributeList for its attributes attribute + delegates constructor to its definition + +FactoryBot::Strategy::Build + it should behave like strategy with callbacks + runs the callbacks [:after_build] with the evaluation's object + returns the object from the evaluation + it should behave like strategy with association support + runs the factory with the correct overrides + finds the factory with the correct factory name + it should behave like strategy with strategy: :build + runs the factory with the correct overrides + finds the factory with the correct factory name + +FactoryBot::Declaration::Implicit + with a known factory + has the correct factory name + creates an association attribute + with a known sequence + does not create an association attribute + creates a sequence attribute #== + when the factories are different + the objects are NOT equal when the attributes are equal the objects are equal when the names are different the objects are NOT equal - when the options are different - the objects are NOT equal when comparing against another type of object the objects are NOT equal + when one is ignored and the other isn't + the objects are NOT equal -FactoryBot after defining an alias - the list of aliases should include a variant with no suffix at all, and one with an '_id' suffix - -FactoryBot::DefinitionProxy#to_create - accepts a block to run in place of #save! - -FactoryBot::Attribute::Dynamic with a string name - name - is expected to eq :name +FactoryBot::Factory with a string for a name + sets build_class correctly with a class with an underscore + has a name FactoryBot::DefinitionProxy#transient makes all attributes added ignored -FactoryBot::AttributeList filter based on ignored attributes - filters #non_ignored attributes - filters #ignored attributes +FactoryBot::AttributeList#define_attribute with a named attribute list + raises when the attribute is a self-referencing association + does not raise when the attribute is not a self-referencing association -FactoryBot::Strategy::Create - runs a custom create block - it should behave like strategy with callbacks - returns the object from the evaluation - runs the callbacks [:after_build, :before_create, :after_create] with the evaluation's object - it should behave like strategy with association support - runs the factory with the correct overrides - finds the factory with the correct factory name +FactoryBot aliases + for a foreign key should include both the suffixed and un-suffixed variants + for an attribute should include the original attribute and a version suffixed with '_id' + for an attribute which starts with an underscore should not include a non-underscored version -FactoryBot::DefinitionProxy#method_missing - declares an implicit declaration when called without args or a block - raises a NoMethodError when called with a static-attribute-like argument - declares a dynamic attribute when called with a block - declares an association when called with a ':factory' key +definition loading + with factories.rb + it should behave like finds definitions + is expected to load definitions from factories.rb + with several factories files under spec/factories + it should behave like finds definitions + is expected to load definitions from spec/factories/post_factory.rb + is expected to load definitions from spec/factories/person_factory.rb + with nested and unnested factories files under test + it should behave like finds definitions + is expected to load definitions from test/factories/person_factory.rb + is expected to load definitions from test/factories/post_factory.rb + is expected to load definitions from test/factories.rb + with deeply nested factory files under spec + it should behave like finds definitions + is expected to load definitions from spec/factories/subdirectory/person_factory.rb + is expected to load definitions from spec/factories/subdirectory/post_factory.rb + with a factories file under test/factories + it should behave like finds definitions + is expected to load definitions from test/factories/post_factory.rb + with several factories files under test/factories in non-alphabetical order + loads the files in the right order + with a factories file under spec/factories + it should behave like finds definitions + is expected to load definitions from spec/factories/post_factory.rb + with a factories file under test + it should behave like finds definitions + is expected to load definitions from test/factories.rb + with a factories file under spec + it should behave like finds definitions + is expected to load definitions from spec/factories.rb + with several factories files under spec/factories in non-alphabetical order + loads the files in the right order + with deeply nested factory files under test + it should behave like finds definitions + is expected to load definitions from test/factories/subdirectory/person_factory.rb + is expected to load definitions from test/factories/subdirectory/post_factory.rb + with several factories files under test/factories + it should behave like finds definitions + is expected to load definitions from test/factories/person_factory.rb + is expected to load definitions from test/factories/post_factory.rb + with nested and unnested factories files under spec + it should behave like finds definitions + is expected to load definitions from spec/factories.rb + is expected to load definitions from spec/factories/post_factory.rb + is expected to load definitions from spec/factories/person_factory.rb -FactoryBot::DefinitionProxy#trait - declares a trait +FactoryBot::AttributeList generating names + knows all its #names + knows all its #names for #ignored attributes + knows all its #names for #associations + knows all its #names for #non_ignored attributes -FactoryBot::Declaration::Implicit +FactoryBot::Factory with a name ending in s + has a name + has a build class + +FactoryBot::Attribute + converts the name attribute to a symbol + is not an association + +FactoryBot::Declaration::Dynamic #== + when the names are different + the objects are NOT equal when the attributes are equal the objects are equal - when the factories are different + when the blocks are different the objects are NOT equal when comparing against another type of object the objects are NOT equal when one is ignored and the other isn't the objects are NOT equal - when the names are different - the objects are NOT equal - with a known sequence - creates a sequence attribute - does not create an association attribute - with a known factory - creates an association attribute - has the correct factory name + +FactoryBot::DefinitionProxy#sequence + creates a new sequence with a block + creates a new sequence with an overridden starting value + creates a new sequence starting at 1 + +FactoryBot::DefinitionProxy#add_attribute + declares a dynamic attribute on the factory when the proxy ignores attributes + declares a dynamic attribute on the factory when the proxy respects attributes + +FactoryBot::Attribute::Association with a string name + name + is expected to eq :name + +FactoryBot::Factory when given a class that overrides #to_s + sets build_class correctly + +FactoryBot::Attribute::Association + builds the association when calling the proc + builds the association when calling the proc + is expected to be association + name + is expected to eq :author FactoryBot::Internal + .trait_by_name + finds a previously registered trait .register_factory registers the provided factory returns the registered factory - .trait_by_name - finds a previously registered trait - .factory_by_name - finds a registered factory + .sequence_by_name + finds a registered sequence + .register_trait + returns the registered trait + registers the provided trait + .register_strategy + register the provided strategy name with the class .rewind_sequences rewinds the sequences and the internal sequences .strategy_by_name finds a registered strategy .factory_by_name finds a registered factory - .sequence_by_name - finds a registered sequence + .register_factory + registers the provided factory + returns the registered factory + .factory_by_name + finds a registered factory .register_sequence returns the registered sequence registers the provided sequence - .register_strategy - register the provided strategy name with the class - .register_trait - returns the registered trait - registers the provided trait - .register_factory - returns the registered factory - registers the provided factory -FactoryBot::Factory human names - parses human names with aliases - parses human names without underscores - parses human names with underscores - parses names without underscores - parses names with underscores - parses human names with big letters - parses names with aliases - parses names with big letters +FactoryBot::AttributeList#associations + returns associations -FactoryBot::Attribute::Sequence - assigns the next value in the sequence - name - is expected to eq :first_name +FactoryBot::DefinitionProxy#association + declares an association + declares an association with options + when passing a block raises an error -FactoryBot::Factory running a factory - calls the block and returns the result - returns the result from the strategy when running - creates the right strategy using the build class when running +FactoryBot::Callback + has a name + runs its block with two parameters + converts strings to symbols + runs its block with no parameters + runs its block with one parameter -FactoryBot::DeclarationList#declare_attribute - appends declarations with the same name when NOT overridable - adds the declaration to the list when not overridable - adds the declaration to the list when overridable - deletes declarations with the same name when overridable +FactoryBot::Decorator::AttributeHash + #attributes + returns a hash of attributes + with an attribute called 'attributes' + does not call itself recursively -FactoryBot::Factory when defined with a class instead of a name - has a name - has a build_class +FactoryBot::DefinitionProxy#trait + declares a trait -FactoryBot::DefinitionProxy#factory - without options - with options - with a block +FactoryBot::Factory + has a factory name + creates a new factory while overriding the parent class + creates a new factory using the class of the parent + has a build class + guesses the build class from the factory name + returns associations + includes associations from the parent factory + when overriding generated attributes with a hash + overrides a symbol parameter with a string parameter + returns the overridden value in the generated attributes + overriding an attribute with an alias + discards the predefined value for the attribute + uses the passed in value for the alias -FactoryBot::NullObject - responds to the given methods - does not respond to other methods +FactoryBot::Attribute::Dynamic + with a block returning its block-level variable + returns self when executing the proc + with a block returning a sequence + raises a sequence abuse error + name + is expected to eq :first_name + with a block referencing an attribute on the attribute + evaluates the attribute from the attribute + with a block returning a static value + returns the value when executing the proc -FactoryBot::Sequence - a custom sequence and scope increments within the correct scope - a custom sequence and scope increments within the correct scope when incrementing - a custom scope increments within the correct scope after rewinding - a sequence with custom value and aliases - has the expected names as its names - behaves like a sequence - has a next value equal to its first value - has a next value equal to the 2nd value after being incremented - has a next value equal to the 1st value after rewinding - a basic sequence - name - is expected to eq :test - behaves like a sequence - has a next value equal to the 1st value after rewinding - has a next value equal to the 2nd value after being incremented - has a next value equal to its first value - names - is expected to eq [:test] - a basic sequence without a block - behaves like a sequence - has a next value equal to the 1st value after rewinding - has a next value equal to the 2nd value after being incremented - has a next value equal to its first value - a custom sequence without a block - behaves like a sequence - has a next value equal to the 1st value after rewinding - has a next value equal to the 2nd value after being incremented - has a next value equal to its first value - a sequence with aliases using default value - has the expected names as its names - behaves like a sequence - has a next value equal to its first value - has a next value equal to the 2nd value after being incremented - has a next value equal to the 1st value after rewinding - a custom sequence - behaves like a sequence - has a next value equal to the 2nd value after being incremented - has a next value equal to the 1st value after rewinding - has a next value equal to its first value - iterating over items in an enumerator - navigates to the next items until no items remain - behaves like a sequence - has a next value equal to the 2nd value after being incremented - has a next value equal to the 1st value after rewinding - has a next value equal to its first value +FactoryBot::Strategy::AttributesFor + does not run the to_create block + returns the hash from the evaluation + it should behave like strategy without association support + returns nil when accessing an association + +FactoryBot::DeclarationList#attributes + defines each attribute on the attribute list + returns an AttributeList + +FactoryBot after defining an alias + the list of aliases should include a variant with no suffix at all, and one with an '_id' suffix FactoryBot::Strategy::Stub - it should behave like strategy with callbacks - returns the object from the evaluation - runs the callbacks [:after_stub] with the evaluation's object it should behave like strategy with association support - finds the factory with the correct factory name - runs the factory with the correct overrides - it should behave like strategy with strategy: :build runs the factory with the correct overrides finds the factory with the correct factory name + it should behave like strategy with callbacks + returns the object from the evaluation + runs the callbacks [:after_stub] with the evaluation's object asking for a result + assigns created_at + is expected not to be destroyed is expected to be persisted is expected not to be new record - is expected not to be destroyed - assigns created_at - overriding persistence method: #connection + overriding persistence method: #increment! overrides the method with any arity raises an informative error if the method is called - overriding persistence method: #update_attributes! - raises an informative error if the method is called - overrides the method with any arity - overriding persistence method: #update_columns + overriding persistence method: #update_attribute overrides the method with any arity raises an informative error if the method is called - overriding persistence method: #increment! + overriding persistence method: #decrement! raises an informative error if the method is called overrides the method with any arity - overriding persistence method: #reload + overriding persistence method: #update_column raises an informative error if the method is called overrides the method with any arity - overriding persistence method: #update_attribute - overrides the method with any arity - raises an informative error if the method is called overriding persistence method: #update! overrides the method with any arity raises an informative error if the method is called - overriding persistence method: #toggle! - raises an informative error if the method is called - overrides the method with any arity overriding persistence method: #destroy! overrides the method with any arity raises an informative error if the method is called - overriding persistence method: #save - raises an informative error if the method is called - overrides the method with any arity - overriding persistence method: #update_column + overriding persistence method: #connection raises an informative error if the method is called overrides the method with any arity - overriding persistence method: #update + overriding persistence method: #destroy overrides the method with any arity raises an informative error if the method is called - overriding persistence method: #touch + overriding persistence method: #update_columns raises an informative error if the method is called overrides the method with any arity - overriding persistence method: #destroy + overriding persistence method: #reload overrides the method with any arity raises an informative error if the method is called overriding persistence method: #delete raises an informative error if the method is called overrides the method with any arity - overriding persistence method: #decrement! + overriding persistence method: #save + overrides the method with any arity + raises an informative error if the method is called + overriding persistence method: #toggle! + overrides the method with any arity + raises an informative error if the method is called + overriding persistence method: #save! raises an informative error if the method is called overrides the method with any arity overriding persistence method: #update_attributes + overrides the method with any arity + raises an informative error if the method is called + overriding persistence method: #touch raises an informative error if the method is called overrides the method with any arity - overriding persistence method: #save! + overriding persistence method: #update + overrides the method with any arity + raises an informative error if the method is called + overriding persistence method: #update_attributes! raises an informative error if the method is called overrides the method with any arity + it should behave like strategy with strategy: :build + runs the factory with the correct overrides + finds the factory with the correct factory name -FactoryBot::Factory when given a class that overrides #to_s - sets build_class correctly - -FactoryBot::Decorator::AttributeHash - #attributes - returns a hash of attributes - with an attribute called 'attributes' - does not call itself recursively - -FactoryBot::DefinitionProxy#association - declares an association - declares an association with options - when passing a block raises an error - -FactoryBot::AttributeList generating names - knows all its #names for #non_ignored attributes - knows all its #names for #associations - knows all its #names - knows all its #names for #ignored attributes - -FactoryBot::Strategy::AttributesFor - returns the hash from the evaluation - does not run the to_create block - it should behave like strategy without association support - returns nil when accessing an association - -FactoryBot::Declaration::Dynamic - #== - when comparing against another type of object - the objects are NOT equal - when one is ignored and the other isn't - the objects are NOT equal - when the attributes are equal - the objects are equal - when the blocks are different - the objects are NOT equal - when the names are different - the objects are NOT equal - -FactoryBot::Attribute::Association with a string name - name - is expected to eq :name - -FactoryBot::DeclarationList#attributes - defines each attribute on the attribute list - returns an AttributeList - -FactoryBot::AttributeList#associations - returns associations +FactoryBot::AttributeList#apply_attributes + adds attributes in the order defined -FactoryBot::DefinitionProxy#initialize_with - defines the constructor on the definition +FactoryBot::DeclarationList#declare_attribute + deletes declarations with the same name when overridable + appends declarations with the same name when NOT overridable + adds the declaration to the list when overridable + adds the declaration to the list when not overridable FactoryBot::EvaluatorClassDefiner - adds each attribute to the evaluator - evaluates the block in the context of the evaluator - returns an evaluator when accessing the evaluator class sets attributes on the evaluator class only instance_execs the block once even when returning nil + adds each attribute to the evaluator + returns an evaluator when accessing the evaluator class + evaluates the block in the context of the evaluator with a custom evaluator as a parent class bases its attribute lists on itself and its parent evaluator -FactoryBot::Strategy::Build - it should behave like strategy with association support - finds the factory with the correct factory name - runs the factory with the correct overrides - it should behave like strategy with strategy: :build - runs the factory with the correct overrides - finds the factory with the correct factory name - it should behave like strategy with callbacks - returns the object from the evaluation - runs the callbacks [:after_build] with the evaluation's object - -FactoryBot::AttributeList#apply_attributes - adds attributes in the order defined - FactoryBot::Registry - adds and returns the object registered - raises when an object cannot be found - iterates registered objects finds a registered object - clears registered factories + knows that an object is registered by symbol + raises when an object cannot be found does not include duplicate objects with registered under different names - knows that an object is registered by string + clears registered factories finds a registered object with square brackets - includes a did_you_mean message is an enumerable - knows that an object is registered by symbol + iterates registered objects + includes a did_you_mean message knows when an object is not registered + knows that an object is registered by string + adds and returns the object registered -FactoryBot - finds a registered strategy - .use_parent_strategy - is true by default - -FactoryBot::Attribute - converts the name attribute to a symbol - is not an association - -FactoryBot::DefinitionProxy#add_attribute - declares a dynamic attribute on the factory when the proxy ignores attributes - declares a dynamic attribute on the factory when the proxy respects attributes +FactoryBot::DefinitionProxy adding callbacks + adding both a :before_stub and a :before_create callback succeeds + adding an :after_build callback succeeds + adding an :after_create callback succeeds + adding an :after_stub callback succeeds + adding both an :after_stub and a :before_create callback succeeds + adding both an :after_stub and an :after_create callback succeeds -FactoryBot::Factory when defined with a custom class - is an instance of that custom class +FactoryBot::Strategy::Create + runs a custom create block + it should behave like strategy with callbacks + returns the object from the evaluation + runs the callbacks [:after_build, :before_create, :after_create] with the evaluation's object + it should behave like strategy with association support + runs the factory with the correct overrides + finds the factory with the correct factory name -FactoryBot::Decorator::DisallowsDuplicatesRegistry - raises when attempting to #register a previously registered strategy - delegates #register to the registry when not registered +FactoryBot::AttributeList filter based on ignored attributes + filters #non_ignored attributes + filters #ignored attributes -definition loading - with several factories files under spec/factories in non-alphabetical order - loads the files in the right order - with nested and unnested factories files under test - it should behave like finds definitions - is expected to load definitions from test/factories/person_factory.rb - is expected to load definitions from test/factories/post_factory.rb - is expected to load definitions from test/factories.rb - with several factories files under test/factories in non-alphabetical order - loads the files in the right order - with factories.rb - it should behave like finds definitions - is expected to load definitions from factories.rb - with a factories file under test - it should behave like finds definitions - is expected to load definitions from test/factories.rb - with several factories files under spec/factories - it should behave like finds definitions - is expected to load definitions from spec/factories/post_factory.rb - is expected to load definitions from spec/factories/person_factory.rb - with a factories file under spec - it should behave like finds definitions - is expected to load definitions from spec/factories.rb - with several factories files under test/factories - it should behave like finds definitions - is expected to load definitions from test/factories/person_factory.rb - is expected to load definitions from test/factories/post_factory.rb - with a factories file under test/factories - it should behave like finds definitions - is expected to load definitions from test/factories/post_factory.rb - with a factories file under spec/factories - it should behave like finds definitions - is expected to load definitions from spec/factories/post_factory.rb - with nested and unnested factories files under spec - it should behave like finds definitions - is expected to load definitions from spec/factories.rb - is expected to load definitions from spec/factories/person_factory.rb - is expected to load definitions from spec/factories/post_factory.rb - with deeply nested factory files under test - it should behave like finds definitions - is expected to load definitions from test/factories/subdirectory/person_factory.rb - is expected to load definitions from test/factories/subdirectory/post_factory.rb - with deeply nested factory files under spec - it should behave like finds definitions - is expected to load definitions from spec/factories/subdirectory/person_factory.rb - is expected to load definitions from spec/factories/subdirectory/post_factory.rb +FactoryBot::Attribute::Dynamic with a string name + name + is expected to eq :name -FactoryBot::AttributeList#define_attribute with a named attribute list - does not raise when the attribute is not a self-referencing association - raises when the attribute is a self-referencing association +FactoryBot::Factory when defined with a custom class name + has a build_class equal to its custom class name -FactoryBot::Factory - guesses the build class from the factory name - creates a new factory while overriding the parent class - returns associations - includes associations from the parent factory - has a factory name - creates a new factory using the class of the parent - has a build class - when overriding generated attributes with a hash - returns the overridden value in the generated attributes - overrides a symbol parameter with a string parameter - overriding an attribute with an alias - uses the passed in value for the alias - discards the predefined value for the attribute +FactoryBot::DefinitionProxy#to_create + accepts a block to run in place of #save! -FactoryBot::Attribute::Association - builds the association when calling the proc - is expected to be association - builds the association when calling the proc - name - is expected to eq :author +FactoryBot::DefinitionProxy#factory + without options + with options + with a block -FactoryBot::NullFactory - has a nil value for its compile attribute - has an instance of FactoryBot::AttributeList for its attributes attribute - delegates constructor to its definition - has a nil value for its class_name attribute - delegates callbacks to its definition - has FactoryBot::Evaluator as its evaluator class - delegates attributes to its definition - delegates defined traits to its definition +FactoryBot::Decorator::DisallowsDuplicatesRegistry + delegates #register to the registry when not registered + raises when attempting to #register a previously registered strategy -FactoryBot::StrategyCalculator - returns the class passed when it is instantiated with a class - finds the strategy by name when instantiated with a symbol - returns the strategy found when instantiated with a symbol +FactoryBot::Factory when defined with a custom class + is an instance of that custom class -Finished in 2.5 seconds (files took 1.36 seconds to load) +Finished in 1.77 seconds (files took 0.93532 seconds to load) 291 examples, 0 failures -Randomized with seed 35672 +Randomized with seed 6886 /usr/bin/ruby3.3 -I/usr/share/rubygems-integration/all/gems/rspec-support-3.13.1/lib:/usr/share/rubygems-integration/all/gems/rspec-core-3.13.0/lib /usr/share/rubygems-integration/all/gems/rspec-core-3.13.0/exe/rspec --pattern spec/acceptance/\*\*/\*_spec.rb --format documentation -Randomized with seed 18336 +Randomized with seed 9174 -initialize_with with FG attributes that are transient - name - is expected to eq "Handsome Chap from .construct" +defaulting `updated_at` + doesn't add updated_at to objects who don't have the method + allows overriding updated_at for objects with updated_at + allows assignment of updated_at + behaves the same as a non-stubbed updated_at + is doesn't mark the object as changed + defaults updated_at for objects with updated_at + doesn't allow setting updated_at on an object that doesn't define it -traits added via strategy - adding traits in attributes_for - [:admin] - is expected to equal true - [:name] - is expected to eq "John" - adding traits in create_list - creates all the records +build multiple instances + with a block that receives both the object and an index + correctly uses the set value + with default attributes + overrides the default values + with a block + correctly uses the set value + without default attributes + uses the default factory values + builds (but doesn't save) all the posts length - is expected to eq 2 - adding traits in build_stubbed - admin - is expected to equal true + is expected to eq 20 + +FactoryBot.rewind_sequences + resets inline sequences back to their starting value + allows setting sequences within identically named traits + resets all sequences back to their starting values + still allows global sequences prefixed with a factory name + does not collide with globally registered factories + +accessing methods from the instance within a dynamic attribute that is also a private method on object + more_format + is expected to eq "format: This is an awesome format" + +modifying factories + raises an exception if the factory was not defined before + allows for overriding child classes + doesn't overwrite already defined child's attributes + redefining attributes + creating user + overriding the name + email + is expected to eq "wonderful-modified@example.com" + name + is expected to eq "wonderful" + overriding the email + email + is expected to eq "perfect@example.com" + name + is expected to eq "Great User" + without overrides + email + is expected to eq "Great User-modified@example.com" + name + is expected to eq "Great User" + creating admin + without overrides + name + is expected to eq "Great User" + admin + is expected to equal true + email + is expected to eq "Great User-modified@example.com" + overriding the email + name + is expected to eq "Great User" + email + is expected to eq "perfect@example.com" + admin + is expected to equal true + overriding the name + admin + is expected to equal true + email + is expected to eq "wonderful-modified@example.com" + name + is expected to eq "wonderful" + adding callbacks + login + is expected to be nil name - is expected to eq "Jack" - adding traits in create - doesn't modify the user factory - admin - is expected to equal true + is expected to eq "great user" + simple modification + doesn't allow the factory to be subsequently defined + does allow the factory to be subsequently modified name - is expected to eq "JOE" - adding traits in build_list - builds all the records - length - is expected to eq 2 - adding traits in build - admin - is expected to equal true + is expected to eq "Great User" + login + is expected to eq "GREAT USER" + reusing traits name - is expected to eq "Joe" + is expected to eq "Johnny Rockstar!!!" + login + is expected to eq "JOHNNY ROCKSTAR!!!" + email + is expected to eq "Johnny Rockstar!!!@example.com" -assigning values from a transient attribute - does not ignore an _id attribute that is an alias for a transient attribute +global to_create + handles child to_create + uses to_create globally across FactoryBot.define + handles child to_create with trait + handles inline trait override + handles base to_create -an instance generated by a factory named a camel case string - registers the UserModel factory +using ActiveSupport::Instrumentation to track run_factory interaction + tracks proper time of creating the record + builds the correct payload -a created instance - is expected not to be new record - assigns and saves associations +association assignment from nested attributes + assigns the correct amount of comments when overridden + assigns the correct amount of comments -associations overriding :strategy - uses the overridden create strategy to create the association +looking up traits that don't exist + when the factory includes an invalid default trait + raises a KeyError including the factory name + maintains 'Did you mean?' suggestions at the end of the error message + when a trait includes an invalid default trait + raises a KeyError including the factory name + when passing an invalid override trait + raises a KeyError -defaulting `updated_at` - allows assignment of updated_at - allows overriding updated_at for objects with updated_at - behaves the same as a non-stubbed updated_at - defaults updated_at for objects with updated_at - doesn't add updated_at to objects who don't have the method - doesn't allow setting updated_at on an object that doesn't define it - is doesn't mark the object as changed +an instance generated by a factory that inherits from another factory + the parent class + is expected not to be admin + login + is expected to eq "john@example.com" + email + is expected to eq "john@example.com" + name + is expected to eq "John" + the child class redefining parent's attributes + is expected to be admin + is expected to be a kind of User(id: integer, name: string, admin: boolean, email: string, upper_email: string, login: string) + upper_email + is expected to eq "ADMIN@EXAMPLE.COM" + name + is expected to eq "admin" + email + is expected to eq "admin@example.com" + login + is expected to eq "admin@example.com" -calling `build_stubbed` with a block - passes the stub instance - returns the stub instance +attribute aliases + assigning an association by foreign key + doesn't assign both an association and its foreign key + assigning an association by passing factory + assigns attributes correctly -traits and dynamic attributes that are applied simultaneously - combined - is expected to eq "John " - email - is expected to eq "John@example.com" - name - is expected to eq "John" +create multiple instances + with a block that receives both the object and an index + uses the new values + with default attributes + overrides the default values + without default attributes + creates all the posts + uses the default factory values + length + is expected to eq 20 + without the count + raise ArgumentError with the proper error message + with a block + uses the new values -callbacks - runs the after(:build) callback when building - runs child callback after parent callback - runs the after(:stub) callback when stubbing - runs both the after(:build) and after(:create) callbacks when creating - runs both the after(:stub) callback on the factory and the inherited after(:stub) callback +assigning overrides that are also private methods on object + some_funky_method + is expected to eq "foobar!" + y + is expected to eq 12345 + more_format + is expected to eq "format: Great" + format + is expected to eq "Great" inline traits overriding existing attributes + prefers inline trait attributes over default attributes prefers inline traits over attributes on factories + prefers overridden attributes over attributes from traits, inline traits, or attributes on factories prefers inline trait attributes over traits on a factory - prefers inline trait attributes over default attributes - prefers attributes on factories over attributes from non-inline traits prefers traits on a factory over default attributes returns the default status - prefers overridden attributes over attributes from traits, inline traits, or attributes on factories + prefers attributes on factories over attributes from non-inline traits -declaring attributes on a Factory that are private methods on Object - link - is expected to eq "http://example.com" - system - is expected to eq false - sleep - is expected to eq -5 +making sure the factory is properly compiled the first time we want to instantiate it + can honor traits on the very first call + +a generated attributes hash + doesn't assign associations + assigns an overridden value + assigns a default value + assigns a lazy, dependent attribute transient sequences increments sequences correctly -trait indifferent access - when trait is defined as a string - can be invoked with a string - can be invoked with a symbol - when trait is defined as integer - can be invoked with a string - can be invoked with as integer - when trait is defined as a symbol - can be invoked with a string - can be invoked with a symbol - when trait is defined as struct - can be invoked with a string - can be invoked with a struct - -initialize_with non-ORM-backed objects - allows for overrides - generates random data +calling `create` with a block + returns the created instance + passes the created instance -initialize_with with a hash argument - builds the object correctly +initialize_with parent and child factories + allows child factories to override initialize_with + uses the parent's constructor when the child factory doesn't assign it -attribute aliases - assigning an association by passing factory - assigns attributes correctly - assigning an association by foreign key - doesn't assign both an association and its foreign key +initialize_with doesn't duplicate assignment on attributes accessed from initialize_with + instantiates the correct object -register custom strategies - allows using the *_pair method to build a list using a custom strategy - allows using the *_list method to build a list using a custom strategy - allows overriding default strategies - allows adding additional strategies +binding a callback to multiple callbacks + does not bind the callback to building + binds the callback to creation + binds the callback to stubbing -skipping the default create - doesn't execute anything when creating the instance +global initialize_with + uses initialize_with globally across FactoryBot.define + handles child initialize_with with trait + handles base initialize_with + handles child initialize_with + handles inline trait override -looking up traits that don't exist - when the factory includes an invalid default trait - raises a KeyError including the factory name - maintains 'Did you mean?' suggestions at the end of the error message - when passing an invalid override trait - raises a KeyError - when a trait includes an invalid default trait - raises a KeyError including the factory name +associations overriding :strategy + uses the overridden create strategy to create the association -calling `attributes_for` with a block - passes the hash of attributes - returns the hash of attributes +initialize_with has access to all attributes for construction + assigns attributes correctly -a built instance with strategy: :create - is expected to be new record - assigns and saves associations +a generated attributes hash where order matters + factory without a parent + assigns attributes in the order they're defined without a parent class + factory with a parent + assigns attributes in the order they're defined -FactoryBot.lint - does not raise when all factories are valid - executes linting in an ActiveRecord::Base transaction - allows for selective linting - raises when a factory is invalid - factory strategy for linting - uses the requested strategy during trait validation - uses the requested strategy - verbose linting - prints the backtrace for each factory error - trait validation - enabled - raises if a trait produces an invalid object - does not raise if a trait produces a valid object - disabled - does not raises if a trait produces an invalid object +initialize_with with FG attributes that are transient + name + is expected to eq "Handsome Chap from .construct" -callbacks using Symbol#to_proc - runs the callback correctly +traits used in associations + allows inline traits with a specific factory for an association + allows assigning traits for the factory of an association + allows inline traits with the default association -an instance generated by a factory - registers the user factory +a built instance with strategy: :create + assigns and saves associations + is expected to be new record -sequences - generates aliases for the sequence that reference the same block and retains value - generates few values of the sequence - generates several values in the correct format - generates aliases for the sequence that reference the same block - generates sequential numbers if no block is given +setting private attributes + raises a NoMethodError associations without overriding :strategy when the :use_parent_strategy config option is set to true @@ -1764,289 +1865,259 @@ when the :use_parent_strategy config option is set to false uses the overridden strategy on the association -a custom create - uses the custom create block instead of save - -a custom create passing in an evaluator - passes the evaluator to the custom create block - -nested factories with different parents - honors :parent over the factory block nesting - -a generated attributes hash - assigns a lazy, dependent attribute - assigns an overridden value - assigns a default value - doesn't assign associations - -defaulting `id` - allows overriding id - -implicit traits containing callbacks - only runs the callback once - -making sure the factory is properly compiled the first time we want to instantiate it - can honor traits on the very first call +`attributes_for` for a class whose constructor has required params + [:name] + is expected to eq "John Doe" -an instance generated by a factory with a custom class name - is expected to be admin - is expected to be a kind of User(id: integer, admin: boolean) +traits added via strategy + adding traits in create_list + creates all the records + length + is expected to eq 2 + adding traits in attributes_for + [:name] + is expected to eq "John" + [:admin] + is expected to equal true + adding traits in build_stubbed + name + is expected to eq "Jack" + admin + is expected to equal true + adding traits in build_list + builds all the records + length + is expected to eq 2 + adding traits in create + doesn't modify the user factory + admin + is expected to equal true + name + is expected to eq "JOE" + adding traits in build + name + is expected to eq "Joe" + admin + is expected to equal true -associations - when building interrelated associations - connects records with interdependent relationships - assigns the instance passed as an association attribute - when accidentally using an implicit declaration for the factory - raises an error - when accidentally using an implicit declaration as an override - raises an error - when building collection associations - builds the association according to the given strategy +traits with callbacks + executes callbacks in the order assigned + when the factory has an implicit trait + name + is expected to eq "JOHN" + when the factory has a trait passed via arguments + name + is expected to eq "JOHN" -accessing methods from the instance within a dynamic attribute that is also a private method on object - more_format - is expected to eq "format: This is an awesome format" +assigning values from a transient attribute + does not ignore an _id attribute that is an alias for a transient attribute defining methods inside FactoryBot raises with a meaningful message -including FactoryBot::Syntax::Methods when custom strategies have been declared - allows adding additional strategies - -multiple creates and transient attributes to dynamically build attribute lists - generates the correct number of posts - allows the number of posts to be modified - -initialize_with doesn't duplicate assignment on attributes accessed from initialize_with - instantiates the correct object +a custom create + uses the custom create block instead of save -overridden primary keys conventions - a stubbed instance with a uuid primary key - builds a stubbed instance - has a uuid primary key - behaves like a persisted record - a stubbed instance with no primary key - behaves like a persisted record - builds a stubbed instance - a stubbed instance with no id setter - builds a stubbed instance +a custom create passing in an evaluator + passes the evaluator to the custom create block -FactoryBot.rewind_sequences - resets all sequences back to their starting values - resets inline sequences back to their starting value - still allows global sequences prefixed with a factory name - does not collide with globally registered factories - allows setting sequences within identically named traits +an instance generated by a factory + registers the user factory -a stubbed instance overriding strategy - acts as if it is saved in the database - assigns associations and acts as if it is saved +traits with to_create + can apply to_create from the definition + gives additional traits higher priority than base traits and factory definition + can apply to_create from traits + gives base traits lower priority than overrides + gives base traits normal priority + gives additional traits higher priority than to_create from the definition -binding a callback to multiple callbacks - binds the callback to creation - binds the callback to stubbing - does not bind the callback to building +attributes defined using Symbol#to_proc + assigns value with override correctly + assigns overridden value correctly + assigns values correctly -calling `create` with a block - passes the created instance - returns the created instance +traits and dynamic attributes that are applied simultaneously + email + is expected to eq "John@example.com" + name + is expected to eq "John" + combined + is expected to eq "John " -calling methods on the model instance - with the referenced attribute being overridden - uses the overridden value - uses the overridden value during attributes_for - without the attribute being overridden - returns nil during attributes_for - doesn't instantiate a record with attributes_for - returns the correct value from the instance - with the attribute being overridden - uses the overridden value - uses the overridden value during attributes_for +defaulting `id` + allows overriding id a generated stub instance - isn't a new record + disables increment! allows toggle - generates unique ids disables toggle! - allows decrement + disables destroy assigns associations - disables save + has an id + disables decrement! + generates unique ids + assigns an overridden attribute assigns associations that aren't new records + assigns a default attribute allows increment - disables destroy - disables update_attribute disables reload - assigns an overridden attribute - disables decrement! - assigns a default attribute - has an id - disables increment! - isn't changed + disables save + isn't a new record + disables update_attribute disables connection + allows decrement + isn't changed -modifying inherited factories with traits - returns the correct value for overridden attributes from traits - returns the correct value for overridden attributes from traits defining multiple attributes - allows modification of attributes created via traits +calling `build_stubbed` with a block + returns the stub instance + passes the stub instance -initialize_with parent and child factories - uses the parent's constructor when the child factory doesn't assign it - allows child factories to override initialize_with +enum traits + when automatically_define_enum_traits is true + builds traits for each enumerated value using a custom enumerable + builds traits for each enumerated value using a provided list of values as a Hash + builds traits automatically for model enum field + prefers user defined traits over automatically built traits + builds traits for each enumerated value using a provided list of values as an Array + when automatically_define_enum_traits is false + raises an error for undefined traits + builds traits for each enumerated value when traits_for_enum are specified -initialize_with with an 'attributes' attribute - assigns attributes correctly +using ActiveSupport::Instrumentation to track compile_factory interaction + tracks proper time of compiling the factory + builds the correct payload + when factory with base traits + builds the correct payload + when factory with additional traits + builds the correct payload -initialize_with with non-FG attributes - name - is expected to eq "John Doe" - age - is expected to eq 21 +an instance generated by a factory named a camel case string + registers the UserModel factory -an instance generated by a factory that inherits from another factory - the child class redefining parent's attributes - is expected to be admin - is expected to be a kind of User(id: integer, name: string, admin: boolean, email: string, upper_email: string, login: string) - login - is expected to eq "admin@example.com" - upper_email - is expected to eq "ADMIN@EXAMPLE.COM" - name - is expected to eq "admin" - email - is expected to eq "admin@example.com" - the parent class - is expected not to be admin - login - is expected to eq "john@example.com" - name - is expected to eq "John" - email - is expected to eq "john@example.com" +including FactoryBot::Syntax::Methods when custom strategies have been declared + allows adding additional strategies -initialize_with implicit constructor - instantiates the correct object +callbacks + runs both the after(:build) and after(:create) callbacks when creating + runs both the after(:stub) callback on the factory and the inherited after(:stub) callback + runs the after(:stub) callback when stubbing + runs the after(:build) callback when building + runs child callback after parent callback -create multiple instances - without default attributes - uses the default factory values - creates all the posts - length - is expected to eq 2 +a stubbed instance overriding strategy + acts as if it is saved in the database + assigns associations and acts as if it is saved applying inline traits applies traits only to the instance generated for that call +multiple creates and transient attributes to dynamically build attribute lists + generates the correct number of posts + allows the number of posts to be modified + +initialize_with non-ORM-backed objects + generates random data + allows for overrides + traits with initialize_with + can apply initialize_with from traits can apply initialize_with from the definition - gives base traits normal priority - gives additional traits higher priority than base traits and factory definition gives base traits lower priority than overrides + gives base traits normal priority gives additional traits higher priority than initialize_with from the definition - can apply initialize_with from traits + gives additional traits higher priority than base traits and factory definition -modifying factories - raises an exception if the factory was not defined before - allows for overriding child classes - doesn't overwrite already defined child's attributes - reusing traits - login - is expected to eq "JOHNNY ROCKSTAR!!!" - name - is expected to eq "Johnny Rockstar!!!" - email - is expected to eq "Johnny Rockstar!!!@example.com" - adding callbacks - name - is expected to eq "great user" - login - is expected to be nil - simple modification - doesn't allow the factory to be subsequently defined - does allow the factory to be subsequently modified - login - is expected to eq "GREAT USER" - name - is expected to eq "Great User" - redefining attributes - creating user - overriding the name - name - is expected to eq "wonderful" - email - is expected to eq "wonderful-modified@example.com" - without overrides - email - is expected to eq "Great User-modified@example.com" - name - is expected to eq "Great User" - overriding the email - email - is expected to eq "perfect@example.com" - name - is expected to eq "Great User" - creating admin - overriding the name - name - is expected to eq "wonderful" - email - is expected to eq "wonderful-modified@example.com" - admin - is expected to equal true - without overrides - email - is expected to eq "Great User-modified@example.com" - admin - is expected to equal true - name - is expected to eq "Great User" - overriding the email - email - is expected to eq "perfect@example.com" - admin - is expected to equal true - name - is expected to eq "Great User" +when a self-referential trait is defined + raises a TraitDefinitionError + raises a TraitDefinitionError -attributes defined using Symbol#to_proc - assigns overridden value correctly - assigns value with override correctly - assigns values correctly +calling `build` with a block + returns the built instance + passes the built instance -assigning overrides that are also private methods on object - format - is expected to eq "Great" - some_funky_method - is expected to eq "foobar!" - more_format - is expected to eq "format: Great" - y - is expected to eq 12345 +calling methods on the model instance + with the referenced attribute being overridden + uses the overridden value during attributes_for + uses the overridden value + with the attribute being overridden + uses the overridden value + uses the overridden value during attributes_for + without the attribute being overridden + returns the correct value from the instance + doesn't instantiate a record with attributes_for + returns nil during attributes_for -global to_create - uses to_create globally across FactoryBot.define - handles base to_create - handles child to_create - handles child to_create with trait - handles inline trait override +syntax methods within dynamic attributes + can access syntax methods from dynamic attributes + allows syntax methods to be used when the block has an arity of 1 + can access methods already existing on the class + can access syntax methods from dynamic attributes + +transient attributes + without transient variables assigned + uses the default value of the attribute + with a transient variable assigned + generates the correct attributes on a rockstar + generates the correct attributes on a groupie + generates the correct attributes on an upcased rockstar + generates the correct attributes on a rockstar with a name + returning attributes for a factory + is expected to have key :email + is expected not to have key :four + is expected not to have key :rockstar + is expected not to have key :upcased + is expected to have key :name + +#add_attribute + assigns attributes for reserved words on .attributes_for + assigns attributes for reserved words on .build + +Ruby 3.0: attributes_for destructuring syntax + supports being destructured + +configuring the starting id + defines which id build_stubbed instances start with an instance generated by a factory with multiple traits - child factory created where trait attributes are inherited - date_of_birth - is expected to eq Sat, 01 Jan 2000 + factory using global trait + name + is expected to eq "Bill" + email + is expected to eq "Bill@example.com" + child class with scoped trait and inherited trait + is expected to be admin + name + is expected to eq "Judy" gender - is expected to eq "Male" - the parent class - is expected not to be admin + is expected to eq "Female" + the child class with one trait + is expected to be admin name is expected to eq "John" gender is expected to be nil - the child class with one trait + factory with implicit traits called by child + calls the correct trait when parent built first + calls the correct trait when child built first + the child with multiple traits is expected to be admin name + is expected to eq "Jane" + gender + is expected to eq "Female" + the parent class + is expected not to be admin + name is expected to eq "John" gender is expected to be nil + factory with trait defined multiple times + great + is expected to eq "GREAT!!!" + child factory redefining trait + great + is expected to eq "EVEN GREATER!!!" the child with multiple traits and overridden attributes is expected to be admin gender @@ -2054,172 +2125,158 @@ name is expected to eq "Jill" the child with multiple traits who override the same attribute - when the male assigns name after female - is expected to be admin - gender - is expected to eq "Male" - name - is expected to eq "Joe" when the female assigns name after male is expected to be admin + name + is expected to eq "Jane" gender is expected to eq "Female" + when the male assigns name after female + is expected to be admin name - is expected to eq "Jane" - factory with trait defined multiple times - great - is expected to eq "GREAT!!!" - child factory redefining trait - great - is expected to eq "EVEN GREATER!!!" + is expected to eq "Joe" + gender + is expected to eq "Male" child factory using grandparents' trait great is expected to eq "GREAT!!!" - factory created with alternate syntax for specifying trait - gender - is expected to eq "Male" - where trait name and attribute are the same - great - is expected to eq "GREAT!!!" - where trait name and attribute are the same and attribute is overridden - great - is expected to eq "SORT OF!!!" the other child class with one trait is expected not to be admin - gender - is expected to eq "Female" - name - is expected to eq "Jane" - the child with multiple traits - is expected to be admin name is expected to eq "Jane" gender is expected to eq "Female" - factory using global trait - name - is expected to eq "Bill" - email - is expected to eq "Bill@example.com" - factory with implicit traits called by child - calls the correct trait when parent built first - calls the correct trait when child built first - child class with scoped trait and inherited trait - is expected to be admin + child factory created where trait attributes are inherited gender - is expected to eq "Female" - name - is expected to eq "Judy" + is expected to eq "Male" + date_of_birth + is expected to eq Sat, 01 Jan 2000 + factory created with alternate syntax for specifying trait + gender + is expected to eq "Male" + where trait name and attribute are the same and attribute is overridden + great + is expected to eq "SORT OF!!!" + where trait name and attribute are the same + great + is expected to eq "GREAT!!!" -build multiple instances - with default attributes - overrides the default values - without default attributes - uses the default factory values - builds (but doesn't save) all the posts - length - is expected to eq 20 - with a block that receives both the object and an index - correctly uses the set value - with a block - correctly uses the set value +initialize_with with non-FG attributes + name + is expected to eq "John Doe" + age + is expected to eq 21 -sequences are evaluated in the correct context - builds a sequence calling sprintf correctly - invokes a method with no arguments on the instance - allows direct reference of a method in a sequence - invokes the correct method on the instance +global skip_create + does not persist child records + honors inline trait to_create + does not persist any record + honors overridden to_create -enum traits - when automatically_define_enum_traits is true - builds traits for each enumerated value using a provided list of values as a Hash - builds traits for each enumerated value using a custom enumerable - builds traits for each enumerated value using a provided list of values as an Array - builds traits automatically for model enum field - prefers user defined traits over automatically built traits - when automatically_define_enum_traits is false - builds traits for each enumerated value when traits_for_enum are specified - raises an error for undefined traits +declaring attributes on a Factory that are private methods on Object + link + is expected to eq "http://example.com" + sleep + is expected to eq -5 + system + is expected to eq false -association assignment from nested attributes - assigns the correct amount of comments - assigns the correct amount of comments when overridden +nested implicit traits + defined inside the factory + it should behave like assigning data from traits + assigns the correct values + defined outside the factory + it should behave like assigning data from traits + assigns the correct values -when a self-referential trait is defined - raises a TraitDefinitionError - raises a TraitDefinitionError +a stubbed instance + acts as if it came from the database + assigns associations and acts as if it is saved -Ruby 3.0: attributes_for destructuring syntax - supports being destructured +callbacks using Symbol#to_proc + runs the callback correctly -global initialize_with - handles child initialize_with with trait - uses initialize_with globally across FactoryBot.define - handles child initialize_with - handles inline trait override - handles base initialize_with +an instance generated by a factory with a custom class name + is expected to be a kind of User(id: integer, admin: boolean) + is expected to be admin -a built instance - is expected to be new record - when the :use_parent_strategy config option is set to false - assigns and saves associations - when the :use_parent_strategy config option is set to true - assigns but does not save associations +trait indifferent access + when trait is defined as integer + can be invoked with as integer + can be invoked with a string + when trait is defined as a string + can be invoked with a string + can be invoked with a symbol + when trait is defined as struct + can be invoked with a struct + can be invoked with a string + when trait is defined as a symbol + can be invoked with a string + can be invoked with a symbol -calling `build` with a block - returns the built instance - passes the built instance +global callbacks + triggers after build callbacks for all factories -custom callbacks - runs a custom after callback when the proper strategy executes - runs a custom callback without prepending before or after when the proper strategy executes - runs a custom before callback when the proper strategy executes +sequences + generates few values of the sequence + generates aliases for the sequence that reference the same block and retains value + generates several values in the correct format + generates sequential numbers if no block is given + generates aliases for the sequence that reference the same block + +sequences are evaluated in the correct context + allows direct reference of a method in a sequence + invokes a method with no arguments on the instance + invokes the correct method on the instance + builds a sequence calling sprintf correctly a created instance, specifying strategy: :build saves associations (strategy: :build only affects build, not create) -global skip_create - does not persist any record - does not persist child records - honors overridden to_create - honors inline trait to_create +implicit traits containing callbacks + only runs the callback once -syntax methods within dynamic attributes - allows syntax methods to be used when the block has an arity of 1 - can access syntax methods from dynamic attributes - can access syntax methods from dynamic attributes - can access methods already existing on the class +initialize_with with a hash argument + builds the object correctly -traits with to_create - gives additional traits higher priority than base traits and factory definition - gives base traits lower priority than overrides - gives base traits normal priority - can apply to_create from traits - gives additional traits higher priority than to_create from the definition - can apply to_create from the definition +register custom strategies + allows overriding default strategies + allows using the *_list method to build a list using a custom strategy + allows adding additional strategies + allows using the *_pair method to build a list using a custom strategy -using ActiveSupport::Instrumentation to track compile_factory interaction - tracks proper time of compiling the factory - builds the correct payload - when factory with base traits - builds the correct payload - when factory with additional traits - builds the correct payload +modifying inherited factories with traits + returns the correct value for overridden attributes from traits + returns the correct value for overridden attributes from traits defining multiple attributes + allows modification of attributes created via traits -callbacks using syntax methods without referencing FactoryBot explicitly - works when the callback has no variables - works when the callback has two variables - works when the callback has one variable +calling `attributes_for` with a block + passes the hash of attributes + returns the hash of attributes -a stubbed instance - acts as if it came from the database - assigns associations and acts as if it is saved +a created instance + assigns and saves associations + is expected not to be new record -global callbacks - triggers after build callbacks for all factories +defaulting `created_at` + behaves the same as a non-stubbed created_at + doesn't add created_at to objects who don't have the method + allows assignment of created_at + is doesn't mark the object as changed + doesn't allow setting created_at on an object that doesn't define it + defaults created_at for objects with created_at + allows overriding created_at for objects with created_at -defining a child factory before a parent - creates admin factories correctly +associations + when building collection associations + builds the association according to the given strategy + when building interrelated associations + assigns the instance passed as an association attribute + connects records with interdependent relationships + when accidentally using an implicit declaration as an override + raises an error + when accidentally using an implicit declaration for the factory + raises an error attribute overrides with no user posting @@ -2232,113 +2289,92 @@ secure is expected to eq false -using ActiveSupport::Instrumentation to track run_factory interaction - tracks proper time of creating the record - builds the correct payload - -finding factories keyed by class instead of symbol - doesn't find the factory - -initialize_with for a constructor that requires a block - executes the block correctly +initialize_with implicit constructor + instantiates the correct object -traits with callbacks - executes callbacks in the order assigned - when the factory has an implicit trait - name - is expected to eq "JOHN" - when the factory has a trait passed via arguments - name - is expected to eq "JOHN" +nested factories with different parents + honors :parent over the factory block nesting -nested implicit traits - defined outside the factory - it should behave like assigning data from traits - assigns the correct values - defined inside the factory - it should behave like assigning data from traits - assigns the correct values +create multiple instances + without default attributes + creates all the posts + uses the default factory values + length + is expected to eq 2 -`attributes_for` for a class whose constructor has required params - [:name] - is expected to eq "John Doe" +reload + does not reset the value of use_parent_strategy -aliases and overrides - two - is expected to be nil - one - is expected to eq "override" +overridden primary keys conventions + a stubbed instance with no id setter + builds a stubbed instance + a stubbed instance with no primary key + behaves like a persisted record + builds a stubbed instance + a stubbed instance with a uuid primary key + behaves like a persisted record + has a uuid primary key + builds a stubbed instance -setting private attributes - raises a NoMethodError +callbacks using syntax methods without referencing FactoryBot explicitly + works when the callback has two variables + works when the callback has no variables + works when the callback has one variable -initialize_with has access to all attributes for construction - assigns attributes correctly +defining a child factory before a parent + creates admin factories correctly -transient attributes - returning attributes for a factory - is expected to have key :name - is expected to have key :email - is expected not to have key :rockstar - is expected not to have key :four - is expected not to have key :upcased - without transient variables assigned - uses the default value of the attribute - with a transient variable assigned - generates the correct attributes on a groupie - generates the correct attributes on a rockstar - generates the correct attributes on an upcased rockstar - generates the correct attributes on a rockstar with a name +FactoryBot.lint + executes linting in an ActiveRecord::Base transaction + does not raise when all factories are valid + allows for selective linting + raises when a factory is invalid + factory strategy for linting + uses the requested strategy + uses the requested strategy during trait validation + trait validation + enabled + raises if a trait produces an invalid object + does not raise if a trait produces a valid object + disabled + does not raises if a trait produces an invalid object + verbose linting + prints the backtrace for each factory error -defaulting `created_at` - behaves the same as a non-stubbed created_at - is doesn't mark the object as changed - doesn't allow setting created_at on an object that doesn't define it - doesn't add created_at to objects who don't have the method - allows assignment of created_at - defaults created_at for objects with created_at - allows overriding created_at for objects with created_at +finding factories keyed by class instead of symbol + doesn't find the factory -reload - does not reset the value of use_parent_strategy +custom callbacks + runs a custom before callback when the proper strategy executes + runs a custom after callback when the proper strategy executes + runs a custom callback without prepending before or after when the proper strategy executes -a generated attributes hash where order matters - factory with a parent - assigns attributes in the order they're defined - factory without a parent - assigns attributes in the order they're defined without a parent class +aliases and overrides + one + is expected to eq "override" + two + is expected to be nil -#add_attribute - assigns attributes for reserved words on .attributes_for - assigns attributes for reserved words on .build +skipping the default create + doesn't execute anything when creating the instance -traits used in associations - allows inline traits with the default association - allows assigning traits for the factory of an association - allows inline traits with a specific factory for an association +initialize_with with an 'attributes' attribute + assigns attributes correctly -configuring the starting id - defines which id build_stubbed instances start with +initialize_with for a constructor that requires a block + executes the block correctly -create multiple instances - without the count - raise ArgumentError with the proper error message - without default attributes - uses the default factory values - creates all the posts - length - is expected to eq 20 - with default attributes - overrides the default values - with a block - uses the new values - with a block that receives both the object and an index - uses the new values +a built instance + is expected to be new record + when the :use_parent_strategy config option is set to true + assigns but does not save associations + when the :use_parent_strategy config option is set to false + assigns and saves associations -Finished in 8.84 seconds (files took 1.55 seconds to load) +Finished in 6.32 seconds (files took 1.07 seconds to load) 374 examples, 0 failures -Randomized with seed 18336 +Randomized with seed 9174 mv ./.gem2deb.Gemfile.lock Gemfile.lock @@ -2373,12 +2409,14 @@ dpkg-buildpackage: info: binary-only upload (no source included) dpkg-genchanges: info: including full source code in upload I: copying local configuration +I: user script /srv/workspace/pbuilder/25724/tmp/hooks/B01_cleanup starting +I: user script /srv/workspace/pbuilder/25724/tmp/hooks/B01_cleanup finished I: unmounting dev/ptmx filesystem I: unmounting dev/pts filesystem I: unmounting dev/shm filesystem I: unmounting proc filesystem I: unmounting sys filesystem I: cleaning the build env -I: removing directory /srv/workspace/pbuilder/27380 and its subdirectories -I: Current time: Fri Mar 21 18:24:45 -12 2025 -I: pbuilder-time-stamp: 1742624685 +I: removing directory /srv/workspace/pbuilder/25724 and its subdirectories +I: Current time: Sat Mar 22 20:26:20 +14 2025 +I: pbuilder-time-stamp: 1742624780