https://github.com/thoughtbot/factory_bot
A library for setting up Ruby objects as test data.
https://github.com/thoughtbot/factory_bot
Keywords
factories factory-bot factory-girl fixtures rails ruby rubygems testing thoughtbot
Keywords from Contributors
activerecord activejob mvc rspec crash-reporting rubocop static-code-analysis code-formatter sinatra sidekiq
Last synced: about 11 hours ago
JSON representation
Repository metadata
A library for setting up Ruby objects as test data.
- Host: GitHub
- URL: https://github.com/thoughtbot/factory_bot
- Owner: thoughtbot
- License: mit
- Created: 2008-06-03T13:55:37.000Z (over 18 years ago)
- Default Branch: main
- Last Pushed: 2026-08-21T15:39:33.000Z (about 1 month ago)
- Last Synced: 2026-09-30T21:52:35.458Z (1 day ago)
- Topics: factories, factory-bot, factory-girl, fixtures, rails, ruby, rubygems, testing, thoughtbot
- Language: Ruby
- Homepage: https://thoughtbot.com
- Size: 4.04 MB
- Stars: 8,169
- Watchers: 122
- Forks: 2,553
- Open Issues: 83
- Releases: 33
-
Metadata Files:
- Readme: README.md
- Changelog: NEWS.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: CODEOWNERS
- Security: SECURITY.md
README.md
factory_bot
factory_bot is a fixtures replacement with a straightforward definition syntax, support for multiple build strategies (saved instances, unsaved instances, attribute hashes, and stubbed objects), and support for multiple factories for the same class (user, admin_user, and so on), including factory inheritance.
If you want to use factory_bot with Rails, see
factory_bot_rails.
Interested in the history of the project name? You can find the history here
Transitioning from factory_girl? Check out the upgrade guide.
Documentation
See our extensive reference, guides, and cookbook in the factory_bot book.
For information on integrations with third party libraries, such as RSpec or
Rails, see the factory_bot wiki.
We also have a detailed introductory video, available for free on Upcase.
Install
Run:
bundle add factory_bot
To install the gem manually from your shell, run:
gem install factory_bot
Supported Ruby versions
Supported Ruby versions are listed in .github/workflows/build.yml (source)
More Information
Useful Tools
- FactoryTrace - helps to find unused factories and traits.
- ruby-lsp-factory_bot / ruby-lsp-rails-factory-bot - integration with ruby-lsp to provide intellisense
Contributing
Please see CONTRIBUTING.md.
factory_bot was originally written by Joe Ferris and is maintained by thoughtbot.
Many improvements and bugfixes were contributed by the open source
community.
License
factory_bot is Copyright © 2008 Joe Ferris and thoughtbot. It is free
software, and may be redistributed under the terms specified in the
LICENSE file.
About thoughtbot
This repo is maintained and funded by thoughtbot, inc.
The names and logos for thoughtbot are trademarks of thoughtbot, inc.
We love open source software!
See our other projects.
We are available for hire.
Owner metadata
- Name: thoughtbot, inc.
- Login: thoughtbot
- Email: hello@thoughtbot.com
- Kind: organization
- Description: We work with organizations of all sizes to design, develop, and grow their web and mobile products.
- Website: https://thoughtbot.com
- Location:
- Twitter:
- Company:
- Icon url: https://avatars.githubusercontent.com/u/6183?v=4
- Repositories: 434
- Last ynced at: 2024-04-14T06:41:37.100Z
- Profile URL: https://github.com/thoughtbot
GitHub Events
Total
- Create event: 31
- Delete event: 42
- Fork event: 22
- Issue comment event: 136
- Issues event: 38
- Pull request event: 95
- Pull request review comment event: 26
- Pull request review event: 49
- Push event: 94
- Release event: 3
- Watch event: 336
Last Year
- Create event: 11
- Delete event: 6
- Fork event: 4
- Issue comment event: 8
- Issues event: 4
- Pull request event: 11
- Pull request review comment event: 2
- Pull request review event: 6
- Push event: 31
- Watch event: 67
Committers metadata
Last synced: 1 day ago
Total Commits: 1,314
Total Committers: 309
Avg Commits per committer: 4.252
Development Distribution Score (DDS): 0.668
Commits in past year: 37
Committers in past year: 19
Avg Commits per committer in past year: 1.947
Development Distribution Score (DDS) in past year: 0.811
| Name | Commits | |
|---|---|---|
| Joshua Clayton | j****n@t****m | 436 |
| Daniel Colson | d****n@g****m | 138 |
| Joe Ferris | j****s@t****m | 138 |
| Mike Burns | m****s@t****m | 22 |
| eugenebolshakov | e****v@g****m | 17 |
| Neil Carvalho | me@n****o | 16 |
| Gabe Berke-Williams | g****e@t****m | 15 |
| Yudai Takada | t****2@g****m | 14 |
| Richie Thomas | r****e@t****m | 13 |
| Thomas Walpole | t****e@g****m | 13 |
| CodeMeister | b****b@k****m | 13 |
| Oliver Peate | o****p@g****m | 10 |
| Oli Peate | o****i@t****m | 9 |
| Valerie Burzynski | v****i@t****m | 9 |
| Alejandro Dustet | a****t@g****m | 8 |
| Joe Ferris | j****s@m****l | 8 |
| Nick Quaranto | n****k@q****o | 7 |
| Earlopain | 1****n | 7 |
| Stefanni Brasil | s****l@g****m | 6 |
| Jon Yurek | j****k@t****m | 6 |
| Ben Orenstein | b****n@g****m | 6 |
| Dan Croak | d****k@t****m | 6 |
| Josh Nichols | j****h@t****m | 6 |
| Matt Jankowski | m****i@t****m | 6 |
| Simone Carletti | w****s@w****t | 6 |
| Chad Pytel | c****l@t****m | 5 |
| Tristan Dunn | t****n@g****m | 5 |
| Kristian Mandrup | k****p@g****m | 5 |
| Nick Quaranto | n****k@t****m | 5 |
| Sarah Lima | s****d@g****m | 4 |
| and 279 more... | ||
Committer domains:
- thoughtbot.com: 30
- me.com: 2
- yandex.ru: 2
- github.com: 2
- matijs.net: 1
- expectedbehavior.com: 1
- snap2web.com: 1
- dio.jp: 1
- iblargz.com: 1
- u2622.ca: 1
- ndpsoftware.com: 1
- wi.mit.edu: 1
- aquachan.de: 1
- familiekranz.de: 1
- novell.com: 1
- 6spot.com.br: 1
- vibes.com: 1
- thorn.co: 1
- we-b.co.jp: 1
- itransition.com: 1
- lawgives.org: 1
- aspgems.com: 1
- mdlogix.com: 1
- outreach.io: 1
- highcode.dk: 1
- scvngr.com: 1
- reframeit.com: 1
- joshsoftware.com: 1
- neil.pro: 1
- katanacode.com: 1
- quaran.to: 1
- technicalpickles.com: 1
- weppos.net: 1
- tysongach.com: 1
- cardflight.com: 1
- suse.com: 1
- instihost.com: 1
- jaredbeck.com: 1
- drapergeek.com: 1
- sikachu.com: 1
- ping.de: 1
- f0x.io: 1
- echographia.com: 1
- oboxodo.com: 1
- launchware.com: 1
- wegowise.com: 1
- sevenwire.com: 1
- blueapron.com: 1
- fixedpoint.xyz: 1
- credible.com: 1
- angilly.com: 1
- ualberta.ca: 1
- wrapbook.com: 1
- schito.me: 1
- dedasys.com: 1
- codeforamerica.org: 1
- zendesk.com: 1
- debian.org: 1
- phlippers.net: 1
- petteriraty.eu: 1
- suschlik.de: 1
- esler.co.nz: 1
- benjaminfleischer.com: 1
- bswtechconsulting.com: 1
- cyt.ch: 1
- urbanautomaton.com: 1
- salimane.com: 1
- nyh.se: 1
- iki.fi: 1
- ctoomey.com: 1
- chrishunt.co: 1
- dartmouth.edu: 1
- freeagent.com: 1
- nickcharlton.net: 1
- mikeshop.net: 1
- pobox.com: 1
- matthewhiggins.com: 1
- mattbrictson.com: 1
- indeo.us: 1
- thatch.ai: 1
- juntostudio.com: 1
- gun.io: 1
- captaincontrat.com: 1
- tutormentor.org: 1
- opensoul.org: 1
- beezwax.net: 1
- o2.pl: 1
- ianduggan.net: 1
- acm.org: 1
- rougecardinal.fr: 1
- red56.co.uk: 1
- feistmantl.io: 1
- obsess.com: 1
- gotocandid.com: 1
- krautcomputing.com: 1
- metaskills.net: 1
- karmi.cz: 1
- suse.de: 1
- spacebabies.nl: 1
- posteo.de: 1
- fearoffish.com: 1
- columbia.edu: 1
- redhat.com: 1
- shopify.com: 1
- mcgeary.org: 1
Issue and Pull Request metadata
Last synced: 1 day ago
Total issues: 140
Total pull requests: 309
Average time to close issues: 5 months
Average time to close pull requests: 3 months
Total issue authors: 125
Total pull request authors: 90
Average comments per issue: 3.09
Average comments per pull request: 1.13
Merged pull request: 156
Bot issues: 0
Bot pull requests: 39
Past year issues: 8
Past year pull requests: 53
Past year average time to close issues: 16 days
Past year average time to close pull requests: 7 days
Past year issue authors: 6
Past year pull request authors: 20
Past year average comments per issue: 1.63
Past year average comments per pull request: 0.4
Past year merged pull request: 23
Past year bot issues: 0
Past year bot pull requests: 3
Top Issue Authors
- mike-burns (8)
- composerinteralia (5)
- vburzynski (3)
- grekko (2)
- jasonkarns (2)
- davidpdrsn (1)
- nbt (1)
- eszancheUez (1)
- slhck (1)
- Talha345 (1)
- mikebaldry (1)
- frenkel (1)
- swelther (1)
- neilvcarvalho (1)
- smaboshe (1)
Top Pull Request Authors
- dependabot[bot] (28)
- CodeMeister (25)
- neilvcarvalho (22)
- hammadxcm (17)
- ydah (13)
- sarahraqueld (12)
- smaboshe (11)
- github-actions[bot] (11)
- vburzynski (10)
- Earlopain (9)
- mike-burns (8)
- stefannibrasil (7)
- composerinteralia (6)
- seanpdoyle (5)
- mattbrictson (4)
Top Issue Labels
- bug (55)
- feature (47)
- good first issue (4)
- attached PR (3)
- documentation (3)
- 7.0 Release (1)
- pending-response (1)
- help wanted (1)
- stale (1)
Top Pull Request Labels
- dependencies (28)
- ruby (24)
- documentation (6)
- github_actions (4)
- bug (2)
- 7.0 Release (2)
- open summit (2)
Package metadata
- Total packages: 13
-
Total downloads:
- rubygems: 713,348,192 total
- Total docker downloads: 1,197,214,746
- Total dependent packages: 520 (may contain duplicates)
- Total dependent repositories: 58,194 (may contain duplicates)
- Total versions: 172
- Total maintainers: 4
gem.coop: factory_bot
factory_bot provides a framework and DSL for defining and using factories - less error-prone, more explicit, and all-around easier to work with than fixtures.
- Homepage: https://github.com/thoughtbot/factory_bot
- Documentation: http://www.rubydoc.info/gems/factory_bot/
- Licenses: MIT
- Latest release: 6.6.0 (published 5 months ago)
- Last Synced: 2026-10-01T01:01:25.609Z (1 day ago)
- Versions: 37
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 356,674,096 Total
- Docker Downloads: 598,607,373
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 0.058%
- Downloads: 0.078%
- Docker downloads count: 0.152%
- Maintainers (4)
rubygems.org: factory_bot
factory_bot provides a framework and DSL for defining and using factories - less error-prone, more explicit, and all-around easier to work with than fixtures.
- Homepage: https://github.com/thoughtbot/factory_bot
- Documentation: http://www.rubydoc.info/gems/factory_bot/
- Licenses: MIT
- Latest release: 6.6.0 (published 5 months ago)
- Last Synced: 2026-10-01T01:01:27.136Z (1 day ago)
- Versions: 37
- Dependent Packages: 520
- Dependent Repositories: 58,193
- Downloads: 356,674,096 Total
- Docker Downloads: 598,607,373
-
Rankings:
- Downloads: 0.085%
- Dependent packages count: 0.09%
- Forks count: 0.11%
- Average: 0.128%
- Dependent repos count: 0.145%
- Stargazers count: 0.147%
- Docker downloads count: 0.193%
- Maintainers (4)
proxy.golang.org: github.com/thoughtbot/factory_bot
- Homepage:
- Documentation: https://pkg.go.dev/github.com/thoughtbot/factory_bot#section-documentation
- Licenses: mit
- Latest release: v6.6.0+incompatible (published 5 months ago)
- Last Synced: 2026-10-01T01:01:27.159Z (1 day ago)
- Versions: 88
- Dependent Packages: 0
- Dependent Repositories: 1
-
Rankings:
- Forks count: 0.131%
- Stargazers count: 0.742%
- Average: 3.53%
- Dependent repos count: 4.79%
- Dependent packages count: 8.456%
ubuntu-24.10: ruby-factory-bot
- Homepage: https://github.com/thoughtbot/factory_bot
- Licenses: mit
- Latest release: 6.4.2-1 (published 8 months ago)
- Last Synced: 2026-08-02T12:08:33.093Z (2 months ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
ubuntu-23.04: ruby-factory-bot
- Homepage: https://github.com/thoughtbot/factory_bot
- Licenses: mit
- Latest release: 6.2.1-1 (published 8 months ago)
- Last Synced: 2026-09-03T11:30:50.728Z (29 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
debian-12: ruby-factory-bot
- Homepage: https://github.com/thoughtbot/factory_bot
- Documentation: https://packages.debian.org/bookworm/ruby-factory-bot
- Licenses: mit
- Latest release: 6.2.1-1 (published 8 months ago)
- Last Synced: 2026-03-13T03:28:47.655Z (7 months ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
ubuntu-22.04: ruby-factory-bot
- Homepage: https://github.com/thoughtbot/factory_bot
- Licenses: mit
- Latest release: 6.2.0-2 (published 8 months ago)
- Last Synced: 2026-03-13T22:41:58.154Z (7 months ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
debian-13: ruby-factory-bot
- Homepage: https://github.com/thoughtbot/factory_bot
- Documentation: https://packages.debian.org/trixie/ruby-factory-bot
- Licenses: mit
- Latest release: 6.5.1-1 (published 8 months ago)
- Last Synced: 2026-03-14T15:02:37.378Z (7 months ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
ubuntu-23.10: ruby-factory-bot
- Homepage: https://github.com/thoughtbot/factory_bot
- Licenses: mit
- Latest release: 6.2.1-1 (published 8 months ago)
- Last Synced: 2026-03-14T02:16:54.651Z (7 months ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
ubuntu-20.04: ruby-factory-bot
- Homepage: https://github.com/thoughtbot/factory_bot
- Licenses: mit
- Latest release: 5.1.1-1 (published 8 months ago)
- Last Synced: 2026-03-13T13:27:22.045Z (7 months ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
debian-10: ruby-factory-bot
- Homepage: https://github.com/thoughtbot/factory_bot
- Documentation: https://packages.debian.org/buster/ruby-factory-bot
- Licenses: mit
- Latest release: 4.11.1-1 (published 8 months ago)
- Last Synced: 2026-03-13T06:00:37.438Z (7 months ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
debian-11: ruby-factory-bot
- Homepage: https://github.com/thoughtbot/factory_bot
- Documentation: https://packages.debian.org/bullseye/ruby-factory-bot
- Licenses: mit
- Latest release: 5.1.1-1 (published 8 months ago)
- Last Synced: 2026-03-14T04:24:01.197Z (7 months ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
ubuntu-24.04: ruby-factory-bot
- Homepage: https://github.com/thoughtbot/factory_bot
- Licenses: mit
- Latest release: 6.4.2-1 (published 8 months ago)
- Last Synced: 2026-03-06T15:59:07.337Z (7 months ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
Dependencies
- activerecord-jdbcsqlite3-adapter >= 0
- sqlite3 >= 0
- activemodel 6.1.3
- activerecord 6.1.3
- activesupport 6.1.3
- appraisal 2.3.0
- aruba 1.0.4
- ast 2.4.2
- builder 3.2.4
- childprocess 4.0.0
- concurrent-ruby 1.1.8
- contracts 0.16.0
- cucumber 5.3.0
- cucumber-core 8.0.1
- cucumber-create-meta 2.0.4
- cucumber-cucumber-expressions 10.3.0
- cucumber-gherkin 15.0.2
- cucumber-html-formatter 9.0.0
- cucumber-messages 13.2.1
- cucumber-tag-expressions 2.0.4
- cucumber-wire 4.0.1
- diff-lcs 1.4.4
- docile 1.3.5
- factory_bot 6.2.1
- ffi 1.14.2
- i18n 1.8.9
- middleware 0.1.0
- minitest 5.14.3
- multi_test 0.1.2
- parallel 1.21.0
- parser 3.1.0.0
- protobuf-cucumber 3.10.8
- rainbow 3.1.1
- rake 13.0.3
- regexp_parser 2.2.0
- rexml 3.2.5
- rspec 3.10.0
- rspec-core 3.10.1
- rspec-expectations 3.10.1
- rspec-its 1.3.0
- rspec-mocks 3.10.2
- rspec-support 3.10.2
- rubocop 1.24.1
- rubocop-ast 1.15.1
- rubocop-performance 1.13.1
- ruby-progressbar 1.11.0
- simplecov 0.21.2
- simplecov-html 0.12.3
- simplecov_json_formatter 0.1.2
- sqlite3 1.4.2
- standard 1.6.0
- sys-uname 1.2.2
- thor 1.1.0
- thread_safe 0.3.6
- tzinfo 2.0.4
- unicode-display_width 2.1.0
- yard 0.9.26
- zeitwerk 2.4.2
- activerecord >= 0 development
- appraisal >= 0 development
- aruba >= 0 development
- cucumber >= 0 development
- rake >= 0 development
- rspec >= 0 development
- rspec-its >= 0 development
- simplecov >= 0 development
- standard >= 0 development
- yard >= 0 development
- activesupport >= 5.0.0
- actions/checkout v2 composite
- actions/checkout v3 composite
- ruby/setup-ruby v1 composite
- actions/checkout v3 composite
- actions/checkout v7 composite
- ruby/setup-ruby v1 composite
- actions/checkout v7 composite
- ruby/setup-ruby v1 composite
- actions/checkout v7 composite
- ruby/setup-ruby v1 composite
- rubygems/release-gem v1 composite
Score: 36.122247286879194