factory_bot icon indicating copy to clipboard operation
factory_bot copied to clipboard

A library for setting up Ruby objects as test data.

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

### Problem this feature will solve Given: ```rb FactoryBot.define do user(factory: :author) { association(:author, role: role) } end ```` [`DefinitionProxy#method_missing`](https://github.com/thoughtbot/factory_bot/blob/907139808d728dbe8da59856afe068b7c0699b2a/lib/factory_bot/definition_proxy.rb#L91-L104) will declare the [association](https://github.com/thoughtbot/factory_bot/blob/master/lib/factory_bot/definition_proxy.rb#L97) and ignore any given `block`-argument. ###...

feature
attached PR
good first issue

Addresses #1503 ## Why Providing an options `factory`-key with an assocation definition effectively ignores a given block. Users might be confused by this behaviour, so we might want to raise...

7.0 Release

Around 20 seconds is spent on installing gems, using gem caching it should make the tests even faster.

### Description When defining enums with a prefix or suffix the trait that is automatically generated does not take into account the prefix or suffix. ### Reproduction Steps ``` class...

bug

### Description When using `FactoryBot.create` to create a model with a dependent association validations that depend on traits will fail because they are applied too late This can be doubly...

bug

### Description When using `uuid` as the primary key type, they `build_stubbed` method does not automatically fill the `id` column. I would assume that this is filled independent of the...

bug

Hey there, I'm having difficulty making one factory that forwards to another. I don't have a particular solution approach in mind, so I didn't use the "feature request" template. For...

### Situation Currently, modeling polymorphic associations is pretty simple, as demonstrated in [GETTING_STARTED.md](https://github.com/thoughtbot/factory_bot/blob/master/GETTING_STARTED.md#polymorphic-associations). However, I have a polymorphic association using the [Exclusive Belongs To/Exclusive Arc](https://hashrocket.com/blog/posts/modeling-polymorphic-associations-in-a-relational-database) method (also seen [here](https://medium.com/@adamlangsner/4-ways-to-model-polymorphic-relationships-in-rails-5-4c98101ed900) using...

feature

### Description A factory can have the same trait multiple times ### Reproduction Steps ```ruby FactoryBot.define do factory :user, class: OpenStruct do trait :admin do name { "Admin" } end...

bug

### Problem this feature will solve FactoryBot allows us to easily define associations that should automatically be constructed when creating or building a model. These associations are statically defined in...

feature