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

This might be a duplicate of #1639. Giving the context to `initialize_with` would give access to the transient attributes when building the object. This way we can make decisions while...

feature

This comes up all the time. Here's an example from a real test: ```ruby prompts = [ create(:prompt, name: "Prompt 1"), create(:prompt, name: "Prompt 2"), create(:prompt, name: "Prompt 3"), ]...

feature

[Zeal](https://zealdocs.org/) (and also [Dash](https://kapeli.com/dash)) provides a beautiful UI to documentation. The documentation is locally stored, available without an Internet connection. Let's get in on that. The [docset](https://kapeli.com/docsets) guide explains how...

feature

I'd like to be able to clearly, safely, and idiomatically create an object and its many relations. For example: ```ruby new_author = create(:author) distinguished_author = create(:author, with_article_count: 3) assert_equal new_author.articles.count,...

feature

Idea for a lint: complain if two factory definitions create the same object. This is a goal towards these ideals: - each factory definition is the _minimum_ required to make...

feature

The `stub` strategy is specific to ActiveRecord. It exists to create a stub of ActiveRecord model instances. Therefore, it should live in `factory_bot_rails`. My hope is that by doing this...

feature

Fixes https://github.com/thoughtbot/factory_bot/issues/1588 Fixes a bug where a class defined with underscores, ex. `factory :customs_declaration_nl_ddu_1, class: "Customs::Declarations::NL::DDU_1_0"` strips out the underscores and then raises an NameError.

### Description Running code that uses the factory bot gem with Ruby 3.3.0 causes the following warnings to be shown: ``` warning: /opt/hostedtoolcache/Ruby/3.3.1/x64/lib/ruby/3.3.0/observer.rb was loaded from the standard library, but...

bug

New feature useful in the following case ```rb ActiveRecord::Schema.define do create_table :todo_lists do; end create_table :todo_items do |t| t.references :todo_list, null: false t.integer :priority, default: 1, null: false t.index [:todo_list_id,...

Add myself, @sarahraqueld as a new maintainer.