Giter Site home page Giter Site logo

instacart / factory_bot_rails Goto Github PK

View Code? Open in Web Editor NEW

This project forked from thoughtbot/factory_bot_rails

0.0 3.0 0.0 163 KB

Factory Bot ♥ Rails

Home Page: https://thoughtbot.com/services/ruby-on-rails

License: MIT License

Ruby 55.08% Shell 1.54% Gherkin 43.38%

factory_bot_rails's Introduction

factory_bot_rails Build Status Code Climate

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.

Transitioning from factory_girl_rails?

Check out the guide.

Rails

factory_bot_rails provides Rails integration for factory_bot.

Currently, automatic factory definition loading is the only Rails-specific feature.

Supported Rails versions are listed in Appraisals. Supported Ruby versions are listed in .travis.yml.

Download

Github: http://github.com/thoughtbot/factory_bot_rails

Gem:

$ gem install factory_bot_rails

Configuration

Add factory_bot_rails to your Gemfile:

group :development, :test do
  gem 'factory_bot_rails'
end

Generators for factories will automatically substitute fixture (and maybe any other fixture_replacement you set). If you want to disable this feature, add the following to your application.rb file:

config.generators do |g|
  g.factory_bot false
end

Default factories directory is test/factories, or spec/factories if test_framework generator is set to :rspec; change this behavior with:

config.generators do |g|
  g.factory_bot dir: 'custom/dir/for/factories'
end

If you use factory_bot for fixture replacement, ensure that factory_bot_rails is available in the development group. If it's not, Rails will generate standard .yml files instead of factory files.

factory_bot takes an option suffix: 'some_suffix' to generate factories as modelname_some_suffix.rb.

If you use factory_bot for fixture replacement and already have a factories.rb file in the directory that contains your tests, factory_bot_rails will insert new factory definitions at the top of factories.rb.

You may need to configure your test suite to include factory_bot methods; see configuration.

Contributing

Please see CONTRIBUTING.md.

Credits

factory_bot was originally written by Joe Ferris.

thoughtbot

factory_bot is maintained and funded by thoughtbot, inc

The names and logos for thoughtbot are trademarks of thoughtbot, inc.

License

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

factory_bot_rails's People

Contributors

agsiegert avatar alsemyonov avatar balinterdi avatar betelgeuse avatar carlosantoniodasilva avatar cgriego avatar croaky avatar cryo28 avatar jdutil avatar jessieay avatar jferris avatar johnjohndoe avatar jordimassaguerpla avatar joshuaclayton avatar joshuaflanagan avatar kreintjes avatar mike-burns avatar mikegehard avatar mjankowski avatar petedmarsh avatar sanemat avatar schmijos avatar spalenza avatar tkeo avatar trevorrjohn avatar vfrride avatar waldyr avatar xander-miller avatar xw19 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.