factory_bot
factory_bot copied to clipboard
A library for setting up Ruby objects as test data.
This feature request came from https://github.com/rubocop/rubocop-factory_bot/pull/52 which has an example reproduction of the problem. ### Problem this feature will solve E.g. with a simple factory: ```ruby factory :post do sequence...
### Description I use simple 1:n associations with models residing in a Rails Engine. The main app includes this engine directly under `/engines`. However, the validation fails for belongs_to associations...
### Description When cloning the current repository on a case-insensitive file system git warns about path collisions: ``` git clone https://github.com/thoughtbot/factory_bot.git tmp … warning: the following paths have collided (e.g....
Replacement for the prematurely closed PR #1518 Why: ---- When defining an association the block-argument will be ignored when also providing a `factory`-key on the association definition. This behaviour might...
I have upgraded my application from rails 5.2 to 6.1. and Ruby from 2.7 to 3.0 but when i rspec my test cases i got this error when i try...
### Problem this feature will solve When working on a large codebase with factories (or traits in my case) that have common names, it's hard to grep/find all usages of...
### Description Calling `FactoryBot.lint([my_factory], traits: true)` will create a factory with every trait it has defined. For most factories and traits, this is fine. However, when a nested factory uses...
### Problem this feature will solve As ActiveStorage is a proper part of rails now, it would be nice if factory bot provided documentation for attaching a file as an...
### Description We have the following factory. ` factory :business_partner do name { Faker::name } company { true } location client default_company { true } end ` The Factory works...
### Problem this feature will solve At GitHub we've recently adopted [Sorbet](https://github.com/sorbet/sorbet) for type annotations in our Ruby code, and we make extensive use of factory_bot in our test suite....