Factories Pulling Too Many Dependencies

Definition:

  • Calling one factory may silently create many associated records, which accumulates to make the whole test suite slow (more on that later)

Code Example:

FactoryBot.define do
  factory :comment do
    post
    body "groundbreaking insight"
  end
end

References:

Quality attributes

  • - Code Example

  • - Cause and Effect

  • - Frequency

  • - Refactoring