thoughtbot / thoughtbot/factory_bot
Invalid Boolean value being stored when enabling eager_load = true in Test Env
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 8.2k
- Forks
- 2.6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
We have the following factory.
factory :business_partner do
name { Faker::name }
company { true }
location
client
default_company { true }
end
The Factory works fine when using eager_load = false in the test environment.However, enabling eager_load the value for the default_company is stored as false which is also set as the default value on Model and DB level for this column.
Reproduction Steps
Run FactoryBot.create(:business_partner) on a Rails console.
System configuration
factory_bot_rails version: 6.2.0
factory_bot version: 6.2.1
rails version: 6.1.6
ruby version: 3.0.4
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in a Rails console with the stated factory_bot, factory_bot_rails, Rails, and Ruby versions, and reproduce FactoryBot.create(:business_partner) with eager_load enabled and disabled. Compare the persisted default_company value and verify that enabling eager_load no longer stores false when the factory sets it to true.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rails, ruby
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100