factory_bot icon indicating copy to clipboard operation
factory_bot copied to clipboard

A library for setting up Ruby objects as test data.

Results 135 factory_bot issues
Sort by recently updated
recently updated
newest added

### Problem this feature will solve Like many, I use the same factory with multiple strategies, based on the individual test. Critically, I want the same code executed on completion,...

feature

Fixes: #1694 Continues: #1695 ## SUMMARY Continuing on from #1695 it was decided that `before(:all)` and `after(:all)` callbacks would provide a solution, without exposing context internals. ## FEATURE Both callbacks...

### Description I tried to get all factories from spree gem, but overriding some of the factories, in this case `user` factories`. I add it them using `require 'spree/testing_support/factories'` in...

bug

I'm trying to figure out how to solve an issue with circular dependencies. For example, I want to create a factory that accepts one of three associations. Whichever association is...

[The YARD gem adds a global `#log` method](https://github.com/lsegal/yard/blob/efb33b5411f54ae491c10ce5cd227fa49b985fde/lib/yard/globals.rb#L20-L22), which becomes a problem if a Factory needs to declare a `log` attribute. Ex: ```ruby FactoryBot.define :event do # This would originally...

Fixes: #1680 Fixes: #1142 Addresses: #1708 When a factory has both \ and \_id, each one is considered an alias for the other and are not assigned correctly. This request...

### Description When an object is created by FactoryBot, and a value with a greater precision than permitted by the DB schema is specified for one of its DateTime fields,...

bug

## Summary Fixes: #1727 Expands trait error messages to include a list of the factory's defined traits. ## Included The message now includes: `Registered traits: [:trait_1, :trait_2, :trait_3]` ## Example...

### Problem this feature will solve I'm refactoring code to use Single Table Inheritance and I'd really like to be able to override the class on each trait as opposed...

feature

Fixes: #1703 CallbacksObserver refactored to ignore an individual callback that has already been run on the given instance. **EXAMPLE** ```ruby factory :user do name { "Jane" } trait :trait_a do...