A library for setting up Ruby objects as test data.

License: MIT

Language: Ruby

Keywords: factories, factory-bot, factory-girl, fixtures, rails, ruby, rubygems, testing, thoughtbot

factory_bot Build Status Code Climate Gem Version Reviewed by Hound

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?

Transitioning from factory_girl?

Check out the guide.


You should find the documentation for your version of factory_bot on Rubygems.

See GETTING_STARTED for information on defining and using factories. We also have a detailed introductory video, available for free on Upcase.


Add the following line to Gemfile:

gem 'factory_bot'

and run bundle install from your shell.

To install the gem manually from your shell, run:

gem install factory_bot

Supported Ruby versions

The factory_bot 5.x series supports MRI Ruby 2.3+.

The factory_bot 3.x+ series supports MRI Ruby 1.9. Additionally, factory_bot 3.6+ supports JRuby while running in 1.9 mode. See GETTING_STARTED for more information on configuring the JRuby environment.

For versions of Ruby prior to 1.9, please use factory_bot 2.x.

More Information

You may also find useful information under the factory_girl tag on Stack Overflow.


Please see

factory_bot was originally written by Joe Ferris and is now maintained by Josh Clayton. Many improvements and bugfixes were contributed by the open source community.


factory_bot is Copyright © 2008-2019 Joe Ferris and thoughtbot. It is free software, and may be redistributed under the terms specified in the LICENSE file.

About thoughtbot


factory_bot 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 or hire us to design, develop, and grow your product.

Project Statistics

Sourcerank 20
Repository Size 2.15 MB
Stars 6,585
Forks 1,873
Watchers 141
Open issues 28
Dependencies 62
Contributors 190
Tags 83
Last updated
Last pushed

Top Contributors See all

Josh Clayton Joe Ferris Daniel Colson Gabe Berke-Williams Eugene Bolshakov Thomas Walpole Nick Quaranto Dan Croak Jon Yurek Ben Orenstein Simone Carletti Josh Nichols Matt Jankowski Tristan Dunn Kristian Mandrup Nick Rivadeneira Oliver Peate Prem Sichanugrist Vasiliy Ermolovich Mike Burns

Packages Referencing this Repo

factory_bot provides a framework and DSL for defining and using factories - less error-prone, mor...
Latest release 5.0.2 - Updated - 6.59K stars
factory_girl provides a framework and DSL for defining and using factories ...
Latest release 4.9.0 - Updated - 6.59K stars

Recent Tags See all

v5.0.2 February 22, 2019
v5.0.1 February 15, 2019
v5.0.0 February 01, 2019
v5.0.0.rc2 January 11, 2019
v5.0.0.rc1 January 06, 2019
v4.11.1 September 07, 2018
v4.11.0 August 15, 2018
v4.10.0 May 25, 2018
v4.9.0 October 23, 2017
v4.8.2 October 20, 2017
v4.8.1 September 28, 2017
v4.8.0 December 16, 2016
v4.7.0 April 01, 2016
v4.5.0 October 17, 2014
v4.4.0 February 11, 2014

Interesting Forks See all

Fixture replacement for focused and readable tests.
Ruby - MIT - Last pushed - 1 stars
A library for setting up Ruby objects as test data.
Ruby - Updated - 1 stars - 1 forks

Something wrong with this page? Make a suggestion

Last synced: 2019-02-22 21:21:23 UTC

Login to resync this repository