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 rubocop crash-reporting sinatra code-formatter static-code-analysis sidekiq
Last synced: about 3 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 17 years ago)
- Default Branch: main
- Last Pushed: 2026-02-10T15:28:51.000Z (21 days ago)
- Last Synced: 2026-02-28T19:52:50.377Z (3 days ago)
- Topics: factories, factory-bot, factory-girl, fixtures, rails, ruby, rubygems, testing, thoughtbot
- Language: Ruby
- Homepage: https://thoughtbot.com
- Size: 3.84 MB
- Stars: 8,353
- Watchers: 123
- Forks: 2,577
- Open Issues: 75
- Releases: 32
-
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
- Release event: 3
- Delete event: 38
- Pull request event: 89
- Fork event: 22
- Issues event: 36
- Watch event: 334
- Issue comment event: 130
- Push event: 78
- Pull request review comment event: 25
- Pull request review event: 49
- Create event: 28
Last Year
- Release event: 3
- Delete event: 27
- Pull request event: 47
- Fork event: 12
- Issues event: 25
- Watch event: 278
- Issue comment event: 56
- Push event: 45
- Pull request review comment event: 22
- Pull request review event: 29
- Create event: 15
Committers metadata
Last synced: 3 days ago
Total Commits: 1,298
Total Committers: 302
Avg Commits per committer: 4.298
Development Distribution Score (DDS): 0.664
Commits in past year: 49
Committers in past year: 18
Avg Commits per committer in past year: 2.722
Development Distribution Score (DDS) in past year: 0.796
| 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 |
| Gabe Berke-Williams | g****e@t****m | 15 |
| Yudai Takada | t****2@g****m | 14 |
| Thomas Walpole | t****e@g****m | 13 |
| CodeMeister | b****b@k****m | 13 |
| Richie Thomas | r****e@t****m | 13 |
| Neil Carvalho | me@n****o | 11 |
| 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 |
| Jon Yurek | j****k@t****m | 6 |
| Ben Orenstein | b****n@g****m | 6 |
| Dan Croak | d****k@t****m | 6 |
| Earlopain | 1****n | 6 |
| Josh Nichols | j****h@t****m | 6 |
| Matt Jankowski | m****i@t****m | 6 |
| Simone Carletti | w****s@w****t | 6 |
| Stefanni Brasil | s****l@g****m | 6 |
| Chad Pytel | c****l@t****m | 5 |
| Kristian Mandrup | k****p@g****m | 5 |
| Nick Quaranto | n****k@t****m | 5 |
| Tristan Dunn | t****n@g****m | 5 |
| Tyson Gach | t****n@t****m | 4 |
| and 272 more... | ||
Committer domains:
- thoughtbot.com: 30
- me.com: 2
- yandex.ru: 2
- github.com: 2
- oboxodo.com: 1
- echographia.com: 1
- winningham.net: 1
- olivierlacan.com: 1
- benjaminfleischer.com: 1
- bswtechconsulting.com: 1
- opensoul.org: 1
- aquachan.de: 1
- chrishunt.co: 1
- ctoomey.com: 1
- dio.jp: 1
- ndpsoftware.com: 1
- wi.mit.edu: 1
- esler.co.nz: 1
- itransition.com: 1
- we-b.co.jp: 1
- mdlogix.com: 1
- juntostudio.com: 1
- aspgems.com: 1
- joshsoftware.com: 1
- lawgives.org: 1
- outreach.io: 1
- highcode.dk: 1
- scvngr.com: 1
- katanacode.com: 1
- neil.pro: 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
- f0x.io: 1
- ping.de: 1
- wegowise.com: 1
- sevenwire.com: 1
- blueapron.com: 1
- credible.com: 1
- angilly.com: 1
- ualberta.ca: 1
- expectedbehavior.com: 1
- matijs.net: 1
- thatch.ai: 1
- fixedpoint.xyz: 1
- launchware.com: 1
- indeo.us: 1
- acm.org: 1
- ianduggan.net: 1
- o2.pl: 1
- beezwax.net: 1
- columbia.edu: 1
- fearoffish.com: 1
- mikeshop.net: 1
- debian.org: 1
- zendesk.com: 1
- codeforamerica.org: 1
- dedasys.com: 1
- schito.me: 1
- iki.fi: 1
- mattbrictson.com: 1
- matthewhiggins.com: 1
- pobox.com: 1
- nickcharlton.net: 1
- freeagent.com: 1
- snap2web.com: 1
- posteo.de: 1
- spacebabies.nl: 1
- suse.de: 1
- karmi.cz: 1
- metaskills.net: 1
- krautcomputing.com: 1
- reframeit.com: 1
- thorn.co: 1
- vibes.com: 1
- 6spot.com.br: 1
- novell.com: 1
- gun.io: 1
- iblargz.com: 1
- mcgeary.org: 1
- salimane.com: 1
- cyt.ch: 1
- rougecardinal.fr: 1
- red56.co.uk: 1
- shopify.com: 1
- redhat.com: 1
- suschlik.de: 1
- petteriraty.eu: 1
- obsess.com: 1
- phlippers.net: 1
- u2622.ca: 1
- feistmantl.io: 1
- familiekranz.de: 1
- tutormentor.org: 1
- urbanautomaton.com: 1
- gotocandid.com: 1
- captaincontrat.com: 1
- nyh.se: 1
Issue and Pull Request metadata
Last synced: 1 day ago
Total issues: 135
Total pull requests: 276
Average time to close issues: 6 months
Average time to close pull requests: 3 months
Total issue authors: 122
Total pull request authors: 81
Average comments per issue: 3.08
Average comments per pull request: 1.19
Merged pull request: 148
Bot issues: 0
Bot pull requests: 37
Past year issues: 15
Past year pull requests: 57
Past year average time to close issues: 8 days
Past year average time to close pull requests: 9 days
Past year issue authors: 15
Past year pull request authors: 16
Past year average comments per issue: 1.8
Past year average comments per pull request: 0.56
Past year merged pull request: 43
Past year bot issues: 0
Past year bot pull requests: 5
Top Issue Authors
- mike-burns (8)
- composerinteralia (5)
- grekko (2)
- jasonkarns (2)
- nbt (1)
- eszancheUez (1)
- slhck (1)
- Talha345 (1)
- mikebaldry (1)
- frenkel (1)
- swelther (1)
- neilvcarvalho (1)
- smaboshe (1)
- MarcusRiemer (1)
- Set27 (1)
Top Pull Request Authors
- dependabot[bot] (27)
- CodeMeister (25)
- neilvcarvalho (18)
- ydah (13)
- sarahraqueld (12)
- smaboshe (11)
- vburzynski (10)
- github-actions[bot] (10)
- mike-burns (8)
- Earlopain (8)
- stefannibrasil (7)
- composerinteralia (6)
- seanpdoyle (5)
- mattbrictson (4)
- grekko (4)
Top Issue Labels
- bug (55)
- feature (46)
- attached PR (3)
- documentation (2)
- pending-response (1)
- 7.0 Release (1)
- good first issue (1)
- stale (1)
Top Pull Request Labels
- dependencies (27)
- ruby (24)
- documentation (6)
- github_actions (3)
- bug (2)
- 7.0 Release (2)
- open summit (2)
Package metadata
- Total packages: 13
-
Total downloads:
- rubygems: 632,010,912 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: 169
- 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.5.6 (published 4 months ago)
- Last Synced: 2026-03-01T16:02:48.566Z (2 days ago)
- Versions: 36
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 315,998,367 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.5.6 (published 4 months ago)
- Last Synced: 2026-03-01T20:31:51.322Z (2 days ago)
- Versions: 36
- Dependent Packages: 520
- Dependent Repositories: 58,193
- Downloads: 316,012,545 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.5.6+incompatible (published 4 months ago)
- Last Synced: 2026-03-02T07:24:49.204Z (1 day ago)
- Versions: 87
- 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%
debian-10: ruby-factory-bot
- Homepage: https://github.com/thoughtbot/factory_bot
- Documentation: https://packages.debian.org/buster/ruby-factory-bot
- Licenses:
- Latest release: 4.11.1-1 (published 20 days ago)
- Last Synced: 2026-02-13T04:21:09.924Z (19 days 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:
- Latest release: 5.1.1-1 (published 19 days ago)
- Last Synced: 2026-02-13T07:13:12.716Z (19 days 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:
- Latest release: 6.2.1-1 (published 18 days ago)
- Last Synced: 2026-02-13T18:19:32.420Z (18 days 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:
- Latest release: 5.1.1-1 (published 21 days ago)
- Last Synced: 2026-02-13T08:20:04.640Z (18 days 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:
- Latest release: 6.2.1-1 (published 21 days ago)
- Last Synced: 2026-02-11T06:39:03.461Z (21 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:
- Latest release: 6.2.1-1 (published 19 days ago)
- Last Synced: 2026-02-12T23:28:58.919Z (19 days 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 19 days ago)
- Last Synced: 2026-02-13T13:15:10.040Z (18 days 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:
- Latest release: 6.2.0-2 (published 18 days ago)
- Last Synced: 2026-02-13T13:16:24.874Z (18 days 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
Score: 36.076933131899324