factory_bot
A library for setting up Ruby objects as test data. (by thoughtbot)
Fake Person
Create some fake personalities (by adamcooke)
DISCONTINUED
Our great sponsors
factory_bot | Fake Person | |
---|---|---|
29 | 0 | |
7,868 | 116 | |
0.0% | - | |
7.7 | 0.0 | |
4 days ago | over 9 years ago | |
Ruby | Ruby | |
MIT License | MIT License |
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
factory_bot
Posts with mentions or reviews of factory_bot.
We have used some of these posts to build our list of alternatives
and similar projects. The last one was on 2023-06-30.
-
Metaprogramming in Ruby: Advanced Level
factory_bot: A fixtures replacement
-
Seeding the DB: Best approach?
Not sure if you want the execution speed to be faster, or the development speed. If it's development, you can use FactoryBot in a script to generate data easily once you have your factories set up.
-
How to optimize factory creation.
The factory-bot gem is used in almost in all of our spec files and it make our set up much more easier than when we use fixtures. Here is the tradeoff, the easier the gem is to use, the more likely you’ll end up with some pain to control its usage. And when the times come to tackle slow tests, the best bet you can take is to start digging into you factories because it’s likely they are the primary reason why your test suite is slowing down
-
Efate Test Generator Series: Extending the library
Efate is actually the second test fixture library I've written and there were several lessons I learned after using the first iteration for several years myself. The first version was influenced a great deal by factor_girl (called factory_bot now), with a heavy dependency on strings to define and create the fixtures. It also wasn't very modular. You couldn't just import a specific fixture, you had to bring in the whole library. And it wasn't very extensible, if you needed to define custom behavior for how a field should be created, it wasn't very pretty.
-
Get help from thoughtbot for free (mentoring / office hours)
I work at thoughtbot, you might know us for our open source work like administrate, factory_bot or shoulda-matchers.
-
Gnarly Learnings From June 2022
As we continue to level-up our skillsets as developers in Rails, the utility of POROs (Plain Old Ruby Objects) becomes more apparent and appealing. Sometimes, the business object(s) you create do not require persistent storage to a database and are, therefore, outside of the scope of an ORM (Object Relational Mapper) like ActiveRecord. But how do we maintain simplicity in our test suite and continue to leverage helpful testing libraries like FactoryBot without one? This instructional article explores how to implement factories for POROs including common pitfalls, building nested resources, and factory linting.
-
Test Data Factories in Javascript
In the ruby world I'm a fan of factory_bot for generating objects that will serve as test data in my unit tests. I had a bit of time to kill this evening and thought it would be fun to implement the subset of the functionality that I use in factory_bot in javascript to see how I would approach it.
-
`method_missing': undefined method `has_paper_trail'
redd@tanya:~/galaxy$ rails s [DEPRECATED] Bootsnap's `autoload_paths_cache:` option is deprecated and will be removed. If you use Zeitwerk this option is useless, and if you are still using the classic autoloader upgrading is recommended. [DEPRECATED] Bootsnap's `disable_trace:` option is deprecated and will be removed. If you use Ruby 2.5 or newer this option is useless, if not upgrading is recommended. DEPRECATION WARNING: The factory_girl gem is deprecated. Please upgrade to factory_bot. See https://github.com/thoughtbot/factory_bot/blob/v4.9.0/UPGRADE_FROM_FACTORY_GIRL.md for further instructions. (called from at /home/redd/galaxy/config/application.rb:9) => Booting Puma => Rails 5.2.7 application starting in development => Run `rails server -h` for more startup options /home/redd/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activerecord-5.2.7/lib/active_record/type.rb:27: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call /home/redd/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activerecord-5.2.7/lib/active_record/type/adapter_specific_registry.rb:9: warning: The called method `add_modifier' is defined here /home/redd/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activemodel-5.2.7/lib/active_model/type/integer.rb:13: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call /home/redd/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activemodel-5.2.7/lib/active_model/type/value.rb:8: warning: The called method `initialize' is defined here /home/redd/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activerecord-5.2.7/lib/active_record/connection_adapters/postgresql/oid/specialized_string.rb:12: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call /home/redd/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activemodel-5.2.7/lib/active_model/type/value.rb:8: warning: The called method `initialize' is defined here Exiting Traceback (most recent call last): 120: from bin/rails:3:in `' 119: from bin/rails:3:in `load' .... 8: from /home/redd/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activesupport-5.2.7/lib/active_support/dependencies.rb:661:in `new_constants_in' 7: from /home/redd/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activesupport-5.2.7/lib/active_support/dependencies.rb:476:in `block in load_file' 6: from /home/redd/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:39:in `load' 5: from /home/redd/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:39:in `load' 4: from /home/redd/galaxy/app/models/users/user.rb:1:in `' 3: from /home/redd/galaxy/app/models/users/user.rb:2:in `' 2: from /home/redd/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/attr_encrypted-3.1.0/lib/attr_encrypted/adapters/active_record.rb:131:in `method_missing_with_attr_encrypted' 1: from /home/redd/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/attr_encrypted-3.1.0/lib/attr_encrypted.rb:306:in `method_missing' /home/redd/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activerecord-5.2.7/lib/active_record/dynamic_matchers.rb:22:in `method_missing': undefined method `has_paper_trail' for # (NoMethodError) Did you mean? has_attached_file
- Five Easy to Miss PostgreSQL Query Performance Bottlenecks
-
It really be like that though
Here is an example from Factory Bot itself, which includes embedded Ruby (in this case):
Fake Person
Posts with mentions or reviews of Fake Person.
We have used some of these posts to build our list of alternatives
and similar projects.
We haven't tracked posts mentioning Fake Person yet.
Tracking mentions began in Dec 2020.
What are some alternatives?
When comparing factory_bot and Fake Person you can also consider the following projects:
Fabrication - This project has moved to GitLab! Please check there for the latest updates.
faker - A library for generating fake data such as names, addresses, and phone numbers.
ffaker - Faker refactored.
Machinist - Fixtures aren't fun. Machinist is.
Forgery - Easy and customizable generation of forged data.
FactoryTrace - Simple tool to maintain factories and traits from FactoryBot
TapReportParser - TAP Report Parser
PaperTrail - Track changes to your rails models
Ruby Tests Profiling Toolbox - Ruby Tests Profiling Toolbox