djezzzl / factory_trace

Simple tool to maintain factories and traits from FactoryBot
MIT License
386 stars 7 forks source link

False negative when factory defined with default traits #12

Closed palkan closed 5 years ago

palkan commented 5 years ago

Example:

# invoices factory
FactoryBot.define do
  factory :object do
    trait :with_user do
      association :user
    end

    trait :with_entity do
      association :entity
    end

    factory :valid_object, traits: [:with_user, :with_entity]
  end
end

FactoryTrace reports unused traits "with_user" and "with_entity" even if "valid_object" factory was used.

djezzzl commented 5 years ago

Hey, thank you for pointing this out 👍 I'll check it today and fix it.

djezzzl commented 5 years ago

Hey, it was fixed by this PR: https://github.com/djezzzl/factory_trace/pull/13. Please try version 0.3.3 and let me know if anything is wrong 👍