All quizzes
Free quiz · 20 questions in the bank

FactoryBot quiz

Test your FactoryBot knowledge with a free interactive quiz — 20 questions with answers and explanations. No signup needed to play.

Question 1/5Score 0

How does FactoryBot let a test override a factory's default attribute value?

Questions in this quiz
  1. How does FactoryBot let a test override a factory's default attribute value?
  2. How is a basic FactoryBot factory typically defined?
  3. What does `FactoryBot.create_list(:user, 5)` do?
  4. How does FactoryBot compare to Rails' built-in fixture files (YAML-based) as a way to generate test data?
  5. What risk does relying on overly elaborate, deeply-nested factory setups introduce for test readability?
  6. Why might a test prefer `FactoryBot.build(:user)` over `FactoryBot.create(:user)` when persistence isn't actually needed?
  7. What is an "association" in a FactoryBot factory, such as `association :author, factory: :user`?
  8. What is the difference between `FactoryBot.build(:user)` and `FactoryBot.create(:user)`?
  9. Why is FactoryBot commonly paired with a gem like Faker for generating realistic-looking attribute values (names, emails, addresses)?
  10. What does it mean for a factory attribute to be defined lazily (inside a block, like `created_at { Time.current }`) rather than eagerly at factory-definition time?
  11. Why might overusing factory associations (auto-creating many related objects for every single test) become a performance concern in a large test suite?
  12. Why is it commonly recommended to keep factory-defined default attribute values minimal/valid rather than piling on excessive complexity?
Gaps to close?
Read the curated FactoryBot notes — core concepts, patterns, interview prep.
FactoryBot notes

More quizzes

.NET.NET MAUIAbsintheAccessibilityActixActix Web