Class: FactoryTrace::Processors::FindUnused
- Inherits:
-
Object
- Object
- FactoryTrace::Processors::FindUnused
- Defined in:
- lib/factory_trace/processors/find_unused.rb
Class Method Summary collapse
-
.call(defined, used) ⇒ Array<Hash>
Finds unused factories and traits.
Class Method Details
.call(defined, used) ⇒ Array<Hash>
Finds unused factories and traits
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/factory_trace/processors/find_unused.rb', line 13 def call(defined, used) mark_as_used(defined, used) output = [] defined.factories.each do |factory| output << append_definition_path({code: :unused, factory_names: factory.names}, factory) unless factory.status factory.traits.each do |trait| output << append_definition_path({code: :unused, factory_names: factory.names, trait_name: trait.name}, trait) unless trait.status end end defined.traits.each do |trait| output << append_definition_path({code: :unused, trait_name: trait.name}, trait) unless trait.status end output.unshift(code: :unused, value: output.size) output.unshift(code: :used, value: defined.total - (output.size - 1)) output end |